Skip to content

MdCheckbox + ServerModule - Cannot read property 'trim' of undefined #6316

@dmitrysteblyuk

Description

@dmitrysteblyuk

Bug, feature request, or proposal:

Bug

What is the expected behavior?

trim on textContent should not be called on server side since it's not defined there.

What is the current behavior?

It is called in MdCheckbox:
[class.mat-checkbox-inner-container-no-side-margin]=\"!checkboxLabel.textContent.trim()\"

Which causes this error many times over without an end:

ERROR TypeError: Cannot read property 'trim' of undefined
    at Object.updateRenderer (\built\prerender\tmp\aot\node_modules\@angular\material\typings\index.ngfactory.js:757:53)
    at Object.updateRenderer (\node_modules\@angular\core\bundles\core.umd.js:12756:70)
    at checkAndUpdateView (\node_modules\@angular\core\bundles\core.umd.js:12275:14)
    at callViewAction (\node_modules\@angular\core\bundles\core.umd.js:12635:21)
    at execComponentViewsAction (\node_modules\@angular\core\bundles\core.umd.js:12567:13)
    at checkAndUpdateView (\node_modules\@angular\core\bundles\core.umd.js:12276:5)
    at callViewAction (\node_modules\@angular\core\bundles\core.umd.js:12635:21)
    at execComponentViewsAction (\node_modules\@angular\core\bundles\core.umd.js:12567:13)
    at checkAndUpdateView (\node_modules\@angular\core\bundles\core.umd.js:12276:5)
    at callViewAction (\node_modules\@angular\core\bundles\core.umd.js:12635:21)
    at execEmbeddedViewsAction (\node_modules\@angular\core\bundles\core.umd.js:12593:17)
    at checkAndUpdateView (\node_modules\@angular\core\bundles\core.umd.js:12271:5)
    at callViewAction (\node_modules\@angular\core\bundles\core.umd.js:12635:21)
    at execComponentViewsAction (\node_modules\@angular\core\bundles\core.umd.js:12567:13)
    at checkAndUpdateView (\node_modules\@angular\core\bundles\core.umd.js:12276:5)
    at callViewAction (\node_modules\@angular\core\bundles\core.umd.js:12635:21)

What are the steps to reproduce?

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

@angular/cli: 1.2.6
node: 8.0.0
os: win32 x64
@angular/animations: 4.3.3
@angular/cdk: 2.0.0-beta.8
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/platform-server: 4.3.3
@angular/router: 4.3.3
@angular/cli: 1.2.6
@angular/compiler-cli: 4.3.3
@angular/language-service: 4.3.3

Is there anything else we should know?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions