Closed beshad closed 6 years ago
It would help if you shared the error messages
Hi Andrew thanks for the quick reply. i have tried multiple libs to see if its the individual library which i set up incorrectly or my import method to this generator. i get various errors regardless of what lib i use. for example here is the setup and error for ng2-toastr:
in main.module.ts:
import { Component, OnInit, ViewContainerRef } from '@angular/core';
import {ToastModule} from 'ng2-toastr/ng2-toastr'; and imports:[ToastModule.forRoot()]
then in main.component.ts:
import { ToastsManager } from 'ng2-toastr/ng2-toastr';
and
...
constructor(public toastr: ToastsManager, vcr: ViewContainerRef) {
this.toastr.setRootViewContainerRef(vcr);
}
ngOnInit() {
this.toastr.success('You are awesome!', 'Success!');
}
and there is the console error message:
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'setRootViewContainerRef' of undefined
TypeError: Cannot read property 'setRootViewContainerRef' of undefined
at new MainComponent (main.component.ts:21)
at createClass (core.js:12481)
at createDirectiveInstance (core.js:12326)
at createViewNodes (core.js:13784)
at createRootView (core.js:13673)
at callWithDebugContext (core.js:15098)
thank you for your help
Well, a few minutes of searching tells me you're using a deprecated module..
use this: https://github.com/scttcper/ngx-toastr
Closing as this isn't an issue with the generator
Hello,
I'm having problem using external libraries with version 5 (Angular) of this generator. i have used the AngularJS version of this many times and used the webpack vendor array to import libraries after installation via npm. have been trying to do the same and but they never worked. here is what i do:
in my webpack.make.js:
vendor: [ ... 'ng2-toastr' ]
then in app.module.ts
import { ToastModule } from 'ng2-toastr/ng2-toastr'; ... imports: [ToastModule.forRoot()] ...
and then use is as each library recommends in my components. (using ng-toast here as an example but i tried others too). same libabries work in a test project generated via angular-cli but here i get various error messages so i know they are not injected properly by me. is there anything that i am missing? the same process worked everytime in AnguarJS version of this generator. cheers