scttcper / ngx-toastr

🍞 Angular Toastr
https://ngx-toastr.vercel.app
MIT License
2.52k stars 358 forks source link

Support angular 2.3.0? #36

Closed jefbarn closed 7 years ago

jefbarn commented 7 years ago

Looks like thinks are broken with Angular 2.3.0...

TypeError: this._appRef.registerChangeDetector is not a function
    at DomPortalHost.attachComponentPortal (dom-portal-host.js:41)
    at DomPortalHost.BasePortalHost.attach (portal.js:128)
    at OverlayRef.attach (overlay-ref.js:12)
    at ToastrService._buildNotification (toastr-service.js:111)
    at ToastrService.error (toastr-service.js:21)
...

Need to use attachView now? http://stackoverflow.com/questions/39857222/angular2-dynamic-component-injection-in-root

scttcper commented 7 years ago

I was waiting for angular-cli to support angular 2.3.0. They seem to be tracking the status of that internally. https://github.com/angular/angular-cli/issues/3467 I guess I could try the downgrade suggestion for testing... I'm on the fence on how to support this while doing the least amount of work

jefbarn commented 7 years ago

Cool, I didn't know angular-cli was having problems. I can fork and try the attachView method against my app and send you a PR if it works.

scttcper commented 7 years ago

https://github.com/angular/material2/blob/master/src/lib/core/portal/dom-portal-host.ts#L46-L76 it does look like material 2 supports the attachView you mentioned.

jefbarn commented 7 years ago

Tried to fork, but can't get my build to run (may just be a 2.3.0 dependency problem, I can't tell). Seems to be hung up on AOT compiler stuff.

Uncaught TypeError: Cannot convert undefined or null to object
    at Function.getPrototypeOf (<anonymous>)
    at ReflectionCapabilities.annotations (http://localhost:8080/app/app.main.df6bdc.js:130531:50)
    at Reflector.annotations (http://localhost:8080/app/app.main.df6bdc.js:130723:44)
    at DirectiveResolver.isDirective (http://localhost:8080/app/app.main.df6bdc.js:60031:61)
    at CompileMetadataResolver._getTypeDescriptor
 ...
scttcper commented 7 years ago

released under npm i toastr-ng2@next until angular-cli is updated

scttcper commented 7 years ago

that was fast. angular-cli is updated now Released under 3.2.1

jefbarn commented 7 years ago

Thanks, works great!

On Thu, Dec 15, 2016 at 3:42 PM, Scott Cooper notifications@github.com wrote:

Closed #36 https://github.com/scttcper/toastr-ng2/issues/36.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/scttcper/toastr-ng2/issues/36#event-896091721, or mute the thread https://github.com/notifications/unsubscribe-auth/AHyO6C679-VrklvXuMZ3iJhZOSbEzbv-ks5rId6BgaJpZM4LNiF- .