2016年4月15日
2016年4月15日
angularjs
自定义指令directive
var m1 = angular.module('myApp',[]);
m1.directive('hello',function(){
return {
restrict:'E',
replace:true,
transclude:true,
controller:function($scope){
this.name='niefee,hello';
},
template:'<div>nihao,<h1 ng-transclude></h1></div>'
};
});
m1.directive('hi',function(){
return {
restrict : 'E',
replace : true,
require : '?^hello',
template : '<span>hi angular</span>',
link:function(scope,element,attr,reController){
console.log(reController.name);
}
}
});$http服务
$location
javascript
节点操作
Last updated