Кода -копия выглядит следующим образом:
<! Doctype html>
<html>
<голова>
<meta charset = "utf-8">
<title> unt назвал документ </title>
</head>
<script src = "http: // localhost: 81/js/jquery.js">
</script>
<script src = "http: // localhost: 81/js/angular.min.js">
</script>
<body ng-app = "app" ng-controller = "c">
<div dir ng-repeat = "item в элементах" ng-model = "m">
{{item}} + {{m}} <br>
</div>
</body>
<Скрипт>
var app = angular.module ("app", []);
Функция C ($ scope) {
$ scope.items = [1,2,2,3,4,5,5];
$ scope.m = "string";
};
app.directive ("dir", function ($ parse) {
возвращаться {
Compile: function ($ compile) {
возвращайте функцию (s, e, a) {
//что .. ..
//a.ngmodel
// Использование $ ("xxx"). Scope.xx = модель
//назначать
//console.log ($ parse (a.ngmodel) .assign (s, "SDFS __________ newvalue___________________dfd"))
SM = "SDFS ____#@$#@$#@$#@$ __ __ DFD Два эффекта одинаковы";
}
}
}
});
</script>
</html>
Выше приведено все содержание руководства по использованию метода $ accope в AngularJs. Надеюсь, вам понравится.