jvandemo / generator-angular2-library

Yeoman generator to create an Angular library
MIT License
752 stars 122 forks source link

How can I route jumps in third-lib packages? #296

Closed deepthan closed 6 years ago

deepthan commented 6 years ago

in the lib, i want to navigate by this.router.navigateByUrl, but got error : core.js:1449 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[LoginComponent -> Router]: StaticInjectorError(Platform: core)[LoginComponent -> Router]: NullInjectorError: No provider for Router! Error: StaticInjectorError(AppModule)[LoginComponent -> Router]: StaticInjectorError(Platform: core)[LoginComponent -> Router]: NullInjectorError: No provider for Router! then i import the router in index.js, Still prompt error. Who can tell me how to do it correctly? thanks a lot.