请哪位看看我这个出什么问题了?运行不出来的
<!DOCTYPE html>
<html ng-app="myApp">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>指令和控制器之间的交互</title>
<body>
<div ng-controller="MyCtrl">
<loader howToLoad="loadData()">滑动加载...</loader>
</div>
<script src="js/angular.js"></script>
<script>
var app=angular.module("myApp",[]);
app.controller('MyCtrl',['$scope',function($scope){
$scope.loadData=function()
{
console.log("数据加载中...");
}
}]);
app.directive("loader",function(){
return
{
restrict:"AE",
link:function(scope,element,attr){
element.bind("mouseenter",function(){
scope.loadData();
})
}
};
});
</script>
</body>
</html>