Prompt with ng-mouseenter in AngularJS

I am trying to get a button to produce a prompt using ng-mouseeneter, but I can't seem to get it working. Below is the code I have.

<span class="button" ng-mouseover="prompt('hello')">Say hello</span>

Answers


The expression you pass into ng-mouseover is not evaluated against the global scope (window object), it's evaluated against an angular $scope.

You can put window.prompt on the $rootScope:

app.run(function($rootScope,$window){

   $rootScope.prompt = $window.prompt;
});

Need Your Help

Get Value in HTML Table using Button

javascript jquery html

I have a simple table that is populated using an array:

Query an XSD for node details using XPath

xml perl xpath xsd

Is there a Perl module that will load an XSD and allow an XPath query to return details e.g. the type of /MemberDetails/MemberNumber, whether it is optional, repeating, and so on.