federicot / ng-message-center

Message library for AngularJS
4 stars 2 forks source link

Api error when the ngMessageCenter doesn't exists #5

Open RicardoRFaria opened 9 years ago

RicardoRFaria commented 9 years ago

When you make call like

ngMessageCenter.success({name: 'sidebar', title: 'Well done!', text: 'Client was successfully saved', next: true});

and the tag doesn't exists with name "sidebar", the api generate error

TypeError: Cannot read property 'current' of undefined
    at Object.service.clear (http://localhost:60636/StyleGuide/bower_components/ng-message-center/ng-message-center.js:60:31)
    at Object.service.add (http://localhost:60636/StyleGuide/bower_components/ng-message-center/ng-message-center.js:36:22)

I think that would be better if the api prints error message telling the problem.

If you agree I can implement this.

federicot commented 9 years ago

Yes, that would be nice.