why in this script:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script>
var app = angular.module( "test", [] );
app.run(
angular.element.prototype.test = function ( ) {
alert ( "da" );
}
);
app.directive('cacat', function() {
return {
restrict: 'E',
link: function (scope, element, attrs) {
}
};
});
</script>
</head>
<body ng-app="test">
<cacat></cacat>
</body>
</html>
function test is called? I want this function called only when I want.
Answer
app.run(
function () {
angular.element.prototype.test = function ( ) {
alert ( "da" );
}
}
);
I haven't other details.
mentioned 7 times?angular.element.prototype
a common way to interact with angular?