javascript - Why does this angularjs directive not work? -
i stuck trying follow tutorial on angularjs directives. i've been unable find syntax errors in code, , i've tried adding jquery.
main.js
var app = angular.module("app", []); app.directive = ("enter", function () { return function (scope, element) { element.bind("mouseenter", function () { console.log("i'm inside of you!"); }); } });
ng.php
<body ng-app="app"> <div enter>i'm content!</div> </body>
both angularjs , main.js linked correctly.
there no console errors reported.
what missing?
app.directive
function, not property.
where have:
app.directive = ('enter'...
should be:
app.directive('enter', function() ...)
so calling function register directive, instead of overriding assignment can never have directives ever again. :)
Comments
Post a Comment