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

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -