Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notifications are not visible #144

Open
martov1 opened this issue Feb 2, 2017 · 32 comments
Open

notifications are not visible #144

martov1 opened this issue Feb 2, 2017 · 32 comments

Comments

@martov1
Copy link

martov1 commented Feb 2, 2017

Hi, thanks for this library.

I added SimpleNotificationsModule to my imports array

in my component.ts file i imported

import { NotificationsService, SimpleNotificationsComponent } from 'angular2-notifications'

and the component itself only consists of


export class DashboardComponent implements OnInit {
  public text: string;
  public environmentName: string;
  public options = {
    position: ["bottom", "left"],
    timeOut: 5000,
    lastOnBottom: true
  }
  constructor(private sessionService: SessionService, private _service: NotificationsService) {
    this.environmentName = environment.name;


  }
  ngOnInit() {
    this._service.alert("hi", "hi")
    this._service.success("this.title", "this.content", {id: 123});

  }

}

in my component.html file I added
<simple-notifications></simple-notifications>

but nothing comes up, i can see the element created but it has zero height and it has no content inside it.
photo

Am i doing something wrong?

@martov1 martov1 changed the title notification are not visible notifications are not visible Feb 2, 2017
@antoinezanardi
Copy link

Same for me, I have the same issue, no errors, the notication just doesn't show up.

Any ideas ?

@flauc
Copy link
Owner

flauc commented Feb 2, 2017

is this version 0.4.51?

@martov1
Copy link
Author

martov1 commented Feb 2, 2017

according to the package.json yes
"version": "0.4.51"

I installed it using NPM today

Thanks for your time <3

@flauc
Copy link
Owner

flauc commented Feb 2, 2017

I think I must have messed something up with the latest release. Can you please try installing 0.4.5?

@martov1
Copy link
Author

martov1 commented Feb 2, 2017

it seems it's not a valid version to download, i can either get 0.4.51 or 0.4.49,
I will try 0.4.49 and get back to you


λ  npm install [email protected] --save
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "[email protected]" "--save"
npm ERR! node v4.4.5
npm ERR! npm  v3.10.8
npm ERR! code ETARGET

npm ERR! notarget No compatible version found: [email protected]
npm ERR! notarget Valid install targets:
npm ERR! notarget 0.4.51, 0.4.49, 0.4.48, 0.4.47, 0.4.46, 0.4.45, 0.4.44, 0.4.43, 0.4.42, 0.4.41, 0.4.4, 0.4.3, 0.4.2, 0.4.1, 0.4.0, 0.3.9, 0.3.8, 0.3.7, 0.3.6, 0.3.5, 0.3.4, 0.3.3, 0.3.2, 0.3.1, 0.3.0, 0.2.6, 0.2.5, 0.2.4, 0.2.3, 0.2.2, 0.2.1, 0.2.0, 0.1.59, 0.1.58, 0.1.57, 0.1.56, 0.1.55, 0.1.54, 0.1.53, 0.1.52, 0.1.51, 0.1.47, 0.1.46, 0.1.44, 0.1.43, 0.1.42, 0.1.41, 0.1.29, 0.1.28, 0.1.27, 0.1.26, 0.1.25, 0.1.24, 0.1.23, 0.1.22, 0.1.21, 0.1.19, 0.1.18, 0.1.17, 0.1.16, 0.1.15, 0.1.14, 0.1.13, 0.1.12, 0.1.11, 0.1.7, 0.1.6, 0.1.4, 0.1.3, 0.1.2, 0.1.1, 0.1.0
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\user\Google Drive\Elance projects\richard\dominiqueUiClient\npm-debug.log

@flauc
Copy link
Owner

flauc commented Feb 2, 2017

meh I really messed up here, okay can you try 0.4.49, and let me know if it works.

@martov1
Copy link
Author

martov1 commented Feb 2, 2017

i installed 0.4.49 but i still have the same problem sadly :/

@antoinezanardi
Copy link

I'm on 0.4.49 now and it is still not showing up ..

@flauc
Copy link
Owner

flauc commented Feb 2, 2017

Hmm.. 0.4.49 works fine for me. Are you on a public project can you share it?

@antoinezanardi
Copy link

antoinezanardi commented Feb 2, 2017

app.component.ts
`export class AppComponent {
public options = {};
title = 'app works!';

constructor(private api: APIService, private notify: NotificationsService) { }
//
ngOnInit(): void {
this.notify.success(
'Some Title',
'Some Content',
);`

app.component.html
<router-outlet></router-outlet> <simple-notifications [options]="options" (onCreate)="created($event)" (onDestroy)="destroyed($event)"></simple-notifications>

Simple as that. Do you find any errors ? Thanks :)

@flauc
Copy link
Owner

flauc commented Feb 2, 2017

No that's all good. And you import in the main module right?

@antoinezanardi
Copy link

imports: [ BrowserModule, SimpleNotificationsModule, PushNotificationsModule]
Here is the main module !

@antoinezanardi
Copy link

There is no error at all, so I don't think it's an error of importing or compiling..

@flauc
Copy link
Owner

flauc commented Feb 2, 2017

Ok can you inspect the html and look at the <simple-notifications></simple-notifications> element. When you create a notification does it show up in there?

@antoinezanardi
Copy link

<!--template bindings={ "ng-reflect-ng-for-of": "" }-->

Nothing is triggered, there is only this comment.

@martov1
Copy link
Author

martov1 commented Feb 2, 2017

I can see the <simple-notifications></simple-notifications> even if i dont trigger an alert on my code.
Not sure if that information is usefull, it would seem that it's not being triggered,but i'm sure that that line of code is being executed.

Any chance you could provide a simple bare bones plnkr with this version to demostrate? maybe i'm doing something wrong somewere.

@antoinezanardi
Copy link

If I console.log(this.notify.success(...)), I can see the object in my console, it is generated with width, text, etc. I think the problem is in the insert into HTML.

@MihailoVasovic
Copy link

we need fix asap!!

@martov1
Copy link
Author

martov1 commented Feb 6, 2017

Take it easy, no one is paying him to support this, if you need the fix immediately then open the code base and do it yourself.

@flauc
Copy link
Owner

flauc commented Feb 6, 2017

Thanks @martov1 👍

Sorry guys I'm completely out of time at the moment, I'll try to work on it as soon as possible. If someone can recreate the issue in a plunkr it would be extremely helpful.

@namhq1989
Copy link

Same here, hope he'll fix this soon! Thanks!

@atapas
Copy link

atapas commented Feb 8, 2017

Tried with 0.4.49 as suggested above but no luck.

image

I see just above. My code is as equal as @antoinezanardi and @martov1 posted.

I understand this fix might take time to come, but is there any tentative date? I am planning to include it for one of my product development hence asking for the time. Sorry about that.

@atapas
Copy link

atapas commented Feb 8, 2017

Hi @flauc, Here is the plunker where I could reproduce the issue..

https://plnkr.co/edit/tyawVR?p=preview

Hope it is useful.

@flauc
Copy link
Owner

flauc commented Feb 8, 2017

Hi @atapas

Thank you for reproducing this, it helps a lot 👍

So I've added a button that calls the notification, and creating a notification from the method called by the button works.

Here is the plunker:
https://plnkr.co/edit/mb2sY6

So it looks like something didn't get initialized when OnInit() is called.

@flauc
Copy link
Owner

flauc commented Feb 8, 2017

Okay so it looks like calling the notification in AfterViewInit() actually works. So you can use that as a fix for now. I'll dig deeper when I get a bit more time to look in to it.

@atapas
Copy link

atapas commented Feb 8, 2017

Awesome @flauc . This works for me to get started. Will consume the updated version once submitted.

@JuliaRakitina
Copy link

JuliaRakitina commented Jun 21, 2017

I have same problem. Notification just does not shows up. On button click too

@basilinjoe
Copy link

@JuliaRakitina may be you have redefine NotificationsService in child component providers

@leomayer
Copy link

leomayer commented Sep 5, 2017

The following code works for me:

private zone: NgZone;
...
this.zone.run(() => {
      this.toast.error(strTitle, strContent);
});

The above code works as wrapper... in ones own app

@flauc To find a permanent fix the EventEmitter in the NotificationsService should be wrapped the same way when emitting an Event, i.e.

export class NotificationsService {
...
 constructor(private zone: NgZone) {}
...
 this.zone.run(() => { // <=== wrapper!!!
      this.emitter.next({command: 'set', notification: notification, add: to});
  });

@Antoshjkee
Copy link

I have got the same error. Any news?

@flauc
Copy link
Owner

flauc commented Sep 5, 2017

@leomayer Thank you for finding this.
@Antoshjkee I will try to resolve this tonight.

@kwiniarski97
Copy link

@flauc any status or ETA?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests