Show message and fade out after N seconds

574 views
Skip to first unread message

Thomas Amsler

unread,
Jun 10, 2013, 7:42:33 PM6/10/13
to ang...@googlegroups.com
I would like to show various types of messages (success, error, warn, info, etc.) after making REST calls and other actions. The message should fade out after N seconds. What is the best way to achieve that.


I have tried to use ng-switch for the various message types where each DIV has a directive "fade-out" that fades out the message after N seconds. This kinda works but is not very maintainable for numerous message types.

<div ng-switch on="createActivityResult">
    <div ng-switch-when="success" fade-out class="alert alert-success">SUCCESS</div>
    <div ng-switch-when="error" fade-out class="alert alert-error">ERROR</div>
    ...
</div>


Any help is greatly appreciated.

Best,
 -- Thomas

Luke Kende

unread,
Jun 10, 2013, 9:07:07 PM6/10/13
to ang...@googlegroups.com
You could...

-  Implement pines notify: http://pinesframework.org/pnotify/ (this is what I did)
-  Implement any jQuery growl like plugin with Angular UIs passthrough
- Create your own directive to do it... I might start with Angular Bootstraps Alert functionality and just customize the directive
Reply all
Reply to author
Forward
0 new messages