AngularJS: Alerts don't show up when multiple messages change ngModel for message

淺唱寂寞╮ 提交于 2019-12-06 07:43:19

You could $watch the model and show the alert when it changes. http://plnkr.co/edit/fJuP9LWH4MNVV1cQs3ED?p=preview

In linker function of your directive:

link: function(scope, element, attrs) {
  scope.$watch('ngModel', function() {
    element.show();
    $timeout(function(){
      //element.empty();
      element.hide();
    }, 5000);
  });
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!