Skip to content

angular material breaks angular universal #883

Closed

Description

@maciejtreder

Bug, feature request, or proposal:

Bug

What is the expected behavior?

elements and content should be prerendered on server side

What is the current behavior?

Exceptions on server side,
ie:

EXCEPTION: ReferenceError: window is not defined
STACKTRACE:
ReferenceError: window is not defined
    at [path_to_my_app]/node_modules/@angular2-material/tabs/tabs.js:109:13
    at ZoneDelegate.invoke ([path_to_my_app]/node_modules/zone.js/dist/zone-node.js:281:29)
    at Zone.run ([path_to_my_app]/node_modules/zone.js/dist/zone-node.js:174:44)
    at NgZoneImpl.runOuter ([path_to_my_app]/node_modules/@angular/core/src/zone/ng_zone_impl.js:88:71)
    at NgZone.runOutsideAngular ([path_to_my_app]/node_modules/@angular/core/src/zone/ng_zone.js:253:80)
    at MdTabGroup.ngAfterViewChecked ([path_to_my_app]/node_modules/@angular2-material/tabs/tabs.js:108:20)
    at AppView._View_ProductsSettingsComponent0.detectChangesInternal (ProductsSettingsComponent.template.js:151:46)
    at AppView.detectChanges ([path_to_my_app]/node_modules/@angular/core/src/linker/view.js:243:14)
    at AppView.detectViewChildrenChanges ([path_to_my_app]/node_modules/@angular/core/src/linker/view.js:269:19)
    at AppView.detectChangesInternal ([path_to_my_app]/node_modules/@angular/core/src/linker/view.js:254:14)
Rendering Document Error: [TypeError: str.replace is not a function]
TypeError: str.replace is not a function
    at escapeString ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:27:10)
    at Serializer._serializeAttributes ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:124:55)
    at Serializer._serializeElement ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:91:10)
    at Serializer._serializeChildNodes ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:72:22)
    at Serializer._serializeElement ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:114:14)
    at Serializer._serializeChildNodes ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:72:22)
    at Serializer._serializeElement ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:114:14)
    at Serializer._serializeChildNodes ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:72:22)
    at Serializer._serializeElement ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:114:14)
    at Serializer._serializeChildNodes ([path_to_my_app]/node_modules/parse5/lib/serialization/serializer.js:72:22)

What are the steps to reproduce?

Try to use <md-tab>s or <md-input>

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

Server side rendering

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

"@angular/core": "2.0.0-rc.4",
"angular2-universal": "~0.104.5",
"@angular2-material/core": "^2.0.0-alpha.6",
node: v5.1.0 and v6.3.0

Activity

  1. maciejtreder commented on Jul 19, 2016

    @maciejtreder
    Author

    Interesting thing is, that few of material items, are rendering well. Ie:

    md-sidenav
    md-toolbar
    md-icon
    md-nav-list

  2. quanterion commented on Jul 19, 2016

    @quanterion
    Contributor

    duplicate of #774

  3. cyrilletuzi commented on Sep 17, 2016

    @cyrilletuzi
    Contributor

    See a temporary workaround here in #308

  4. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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