scope中的@绑定方法
<!DOCTYPE html>
<html ng-app="a">
<head>
<meta charset="UTF-8">
<title>angularJs-scope的绑定策略-@绑定方法</title>
<script scr="script/angular.js"></script>
</head>
<body>
<div ng-controller="MyCtrl">
<!--drink自定义指令,flaovr自定义属性-->
<drink flaovr="{{ctrlFlaor}}"></drink>
</div>
<script>
var MyModuel=angular.module('a', []); //为何报这里未定义?
MyModuel.controller('MyCtrl', ['$scope', function($scope){
$scope.ctrlFlaor="百威";
}]);
MyModuel.directive('drink',function(){
return{
restrict:'AE',
template:'<div>{{flaovr}}</div>',
link:function(scope,element,attrs){
scope.flaovr=attrs.flaovr;
}
}
});
</script>
</body>
</html>