这节源码基础上改的指令绑定不上,求大神指点
var manyList=angular.module('manyList',['ngRoute','ngAnimate','ManyListCtrls','ManyListFilters','ManyListDirectives','ManyListServices']);
这是app.js模块注入,下面的是其他文件截图
var manyList=angular.module('manyList',['ngRoute','ngAnimate','ManyListCtrls','ManyListFilters','ManyListDirectives','ManyListServices']);
这是app.js模块注入,下面的是其他文件截图
2016-11-04
//directives.js var manyListDirectives=angular.module('manyListDirectives',[]); manyListDirectives.directive('myBook',['$scope',function($scope){ return{ restrict:'AECM', template: '<div>这是一条指令</div>', replace: true, scope: true, link:function(scope,element,attrs){ element.bind('mouseenter',function(event){ console.log(0); }) } } }]); //controllers.js manyListCtrls.controller('bookCtrl',['$scope',function($scope){ }]); //booklist.html <myBook></myBook> //app.js var manyList=angular.module('manyList',['ngRoute','ngAnimate','manyListCtrls','manyListFilters', 'manyListDirectives','manyListServices']); manyList.config(function($routeProvider){ $routeProvider.when('/hello',{ templateUrl:'templates/hello.html', controller:'helloCtrl' }).when('/book',{ templateUrl:'templates/booklist.html', controller:'bookCtrl' }).otherwise({ redirectTo:'/hello' }) })
举报