发布网友
共1个回答
热心网友
angularjs的指令编写的时候,我们可以在controller中去注入当前使用该directive的$scope;
directive('footCommen', function() {
return {
restrict: 'AE',
controller:function($scope){
//这里的 $scope注入的是当前使用这个directive的$scope对象
//当然这里也可以注入其他的,比如$rootScope/$window等
},
replace: false
}
});