1

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>

1 Answer 1

1

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;
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.