AngularJS - AlertFactory Dialog Behavior

I create an AlertFactory because ui.bootstrap.dialog does not work in my application.

So enter the following code: http://jsfiddle.net/Premier/BHqKB/17/

enter code here 

It works very well if you click the "Open dialog" button: a dialog with my messages will appear on the screen.

I also register the listener on keydown: the listener fires a broadcast event on which the function associated with the scope is registered. This function calls openDialog to display a dialog. Thus, angular does not interpolate the arguments, and the warning is displayed using {{title}} placeholder.

What is wrong in my code?

Thank.

+1
angularjs angularjs-service angularjs-scope
Mar 22 '13 at 8:03
source share
1 answer

To invoke the digest loop, you need $apply .

 ng.element(document).on('keydown', function(e){ //alert('keydown'); //openDialog(); $rootScope.$broadcast('openDialog'); $rootScope.$apply(); }); 
+1
Mar 22 '13 at 13:37
source share



All Articles