0

I have the following code:

elem.bind('keydown keyup keypress', function(event) {}

I use keydown, keyup, keypress event. and want to add load event. how do I add load event?

1
  • what is the purpose of using of load event ? Commented May 26, 2016 at 5:49

1 Answer 1

1
angular("mymodule").directive( 'onReady', function( $parse ) {
   return {
       restrict: 'AE',
       link: function( $scope, elem, attrs ) {    
          elem.ready(function(){
            $scope.$apply(function(){
                var func = $parse(attrs.onReady);
                func($scope);
            })
          })
       }
    }
})

use it like

<div on-ready="mymethod()"></div>

where mymethod is ur function in controller

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.