コードコピーは次のとおりです。
<!doctype html>
<html>
<head>
<メタcharset = "utf-8">
<title> un unt ittitled document </title>
</head>
<スクリプトsrc = "http:// localhost:81/js/jquery.js">
</script>
<スクリプトsrc = "http:// localhost:81/js/angular.min.js">
</script>
<body ng-app = "app" ng-controller = "c">
<div dir ng-repeat = "アイテムのアイテム" ng-model = "m">
{{item}} + {{m}} <br>
</div>
</body>
<スクリプト>
var app = angular.module( "app"、[]);
関数c($ scope){
$ scope.items = [1,2,3,4,5,5];
$ scope.m = "string";
};
app.directive( "dir"、function($ parse){
戻る {
コンパイル:function($ compile){
return function(s、e、a){
//何 .. ..
//a.ngmodel
// $( "xxx")。scope.xx= modelを使用します
//割り当てる
//console.log($ parse(a.ngmodel).assign(s、 "sdfs __________ newValue_________________________________________
sm = "sdfs ____#@$#@$#@$#@$ __ dfdの2つの効果は同じです";
}
}
}
});
</script>
</html>
上記は、AngularJSで$スコープメソッドを使用するためのガイドのコンテンツ全体です。気に入っていただければ幸いです。