Closed htrex closed 6 years ago
Change in app.module from
import { SimpleNotificationsModule } from 'angular2-notifications';
imports:[
BrowserModule,
SimpleNotificationsModule.forRoot(),
]
to
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SimpleNotificationsModule } from 'angular2-notifications';
imports: [
CommonModule,
BrowserAnimationsModule,
SimpleNotificationsModule.forRoot(),
]
I'm still having an issue with my template when trying to use it:
**Error: Template parse errors: 'simple-notifications' is not a known element:
I tried to import the component without success!
@LucasBrazi06 The change you proposed didn't solve the issue, I still receive
Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
When I lazy load any module with SimpleNotificationsModule class enabled.
Same problem here :
I'm having the same problem in version 0.5.7, using webpack. I tried to fiddle with the imports, but I can't even find an import of BrowserModule anywhere in the repo, only BrowserAnimationsModule. I am just using simple-notifications, no push-notifications.
I don't get it. I don't import BrowserModule anywhere. Do you think BrowserAnimationsModule is what is causing it?
I updated @angular/angular and related libraries to stable version 4.0.3, I was still on a beta version. The BrowserModule error is gone now. I now get
ERROR Error: Uncaught (in promise): Error: Template parse errors:
'simple-notifications' is not a known element
I'm trying to fix it by moving my declarations around.
By trial and error I got it working! Here's what I have now.
In app.module.ts
:
import { SimpleNotificationsModule } from 'angular2-notifications';
...
imports: [
CommonModule,
SimpleNotificationsModule.forRoot(),
In app.component.ts
:
template: '<router-outlet></router-outlet>
<simple-notifications [options]="notificationOptions"></simple-notifications>'
...
export class App {
notificationsOptions:any = {
'position': ['top', 'right']
};
And then in the component where I want to show the notification, for example layout.component.ts
:
import { NotificationsService } from 'angular2-notifications';
...
constructor( private _notificationService : NotificationsService ){
_notificationService.success('hallo', 'hoi');
}
This is great, thank you so much 👍
@flauc After upgrading from 0.4.53 I got this problem too. Below is my solution. I just commented BrowserAnimationsModule in both node_modules/angular2-notifications/dist/src/simple-notifications.module.js and node_modules/angular2-notifications/src/simple-notifications.module.ts.
it works for me now.
I'm using angular4.0.3 and angular2-notifications 0.5.7, and in my app.module.ts I'm using BrowserAnimationsModule .
I'm lazy loading modules and am also seeing this issue (ng4.1.0) An official release with removed BrowserAnimationsModule references would be much appreciated. Thanks for all the hard work, great plugin.
This is resolved in the latest release. Please reopen if you are still getting it
im still getting this issue
On an angular-cli 1.0.0 project using Angular 4.0.1, if I upgrade this package from 0.4.53 to 0.5.3 I'm seeing the following error, changing back package.json to 0.4.53 and npm install again solves the problem.
ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead. Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.