Skip to content

MdSnackBar error with AOT compilation #3798

Closed

Description

@ocarreterom

Bug, feature request, or proposal:

Bug.

What is the expected behavior?

MdSnackBar works with AOT compilation.

What is the current behavior?

MdSnackBar doesn't work with AOT compilation (angular/cli).

ERROR Error: Uncaught (in promise): Error: No provider for t!
Error
    at g (polyfills.794b327….bundle.js:36)
    at k (vendor.4ef56f0….bundle.js:204)
    at O (vendor.4ef56f0….bundle.js:204)
    at t._throwOrNull (vendor.4ef56f0….bundle.js:351)
    at t._getByKeyDefault (vendor.4ef56f0….bundle.js:351)
    at t._getByKey (vendor.4ef56f0….bundle.js:351)
    at t.get (vendor.4ef56f0….bundle.js:351)
    at e.get [as _MdSnackBar_104] (main.b2f8da9….bundle.js:1)
    at e.getInternal (main.b2f8da9….bundle.js:1)
    at e.t.get (vendor.4ef56f0….bundle.js:365)
    at e.t.get (vendor.4ef56f0….bundle.js:365)
    at t.get [as _MdSnackBar_67] (13.d98dce3….chunk.js:8)
    at t.getInternal (13.d98dce3….chunk.js:8)
    at t.get (vendor.4ef56f0….bundle.js:365)
    at un (vendor.4ef56f0….bundle.js:281)
    at g (polyfills.794b327….bundle.js:36)
    at k (vendor.4ef56f0….bundle.js:204)
    at O (vendor.4ef56f0….bundle.js:204)
    at t._throwOrNull (vendor.4ef56f0….bundle.js:351)
    at t._getByKeyDefault (vendor.4ef56f0….bundle.js:351)
    at t._getByKey (vendor.4ef56f0….bundle.js:351)
    at t.get (vendor.4ef56f0….bundle.js:351)
    at e.get [as _MdSnackBar_104] (main.b2f8da9….bundle.js:1)
    at e.getInternal (main.b2f8da9….bundle.js:1)
    at e.t.get (vendor.4ef56f0….bundle.js:365)
    at e.t.get (vendor.4ef56f0….bundle.js:365)
    at t.get [as _MdSnackBar_67] (13.d98dce3….chunk.js:8)
    at t.getInternal (13.d98dce3….chunk.js:8)
    at t.get (vendor.4ef56f0….bundle.js:365)
    at un (vendor.4ef56f0….bundle.js:281)
    at g (polyfills.794b327….bundle.js:36)
    at l (polyfills.794b327….bundle.js:36)
    at l (polyfills.794b327….bundle.js:36)
    at polyfills.794b327….bundle.js:36
    at t.invokeTask (polyfills.794b327….bundle.js:36)
    at Object.onInvokeTask (vendor.4ef56f0….bundle.js:365)
    at t.invokeTask (polyfills.794b327….bundle.js:36)
    at n.runTask (polyfills.794b327….bundle.js:36)
    at u (polyfills.794b327….bundle.js:36)
    at XMLHttpRequest.invoke (polyfills.794b327….bundle.js:36)

What are the steps to reproduce?

Import MdSnackBar as DI in any component and run npm run build -- -prod.

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

angular/material: 2.0.0-beta.2 (from material2-builds)
angular/cli: 1.0.0
node: 7.7.4
os: darwin x64
angular: 4.0.0

Activity

  1. changed the title [-]MdSnakBar error with AOT compilation[/-] [+]MdSnackBar error with AOT compilation[/+] on Mar 27, 2017
  2. PManaras commented on Mar 27, 2017

    @PManaras

    I had the same issue, fixed it by adding ' LiveAnnouncer' to the list of providers, after importing:
    import { MaterialModule, LiveAnnouncer } from '@angular/material';

  3. self-assigned this
    on Mar 27, 2017
  4. added
    P3
    on Mar 29, 2017
  5. 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.

  6. 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

Labels

P3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions