angularJS 中$scope方法使用指南
更新时间:2015年02月09日 10:56:43 投稿:hebedich
这篇文章主要介绍了angularJS 中$scope方法使用指南,需要的朋友可以参考下
复制代码 代码如下:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</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 in items" ng-model="m">
{{item}} + {{m}} <br>
</div>
</body>
<script>
var app = angular.module("app", []);
function c($scope){
$scope.items = [1,2,2,3,4,5,5];
$scope.m = "string";
};
app.directive("dir",function($parse){
return {
compile : function( $compile ){
return function(s,e,a){
//what .. ..
//a.ngModel
//用$("xxx").scope.xx = model
//assign 分配
//console.log( $parse( a.ngModel ).assign(s,"sdfs__________newValue__________dfd") )
s.m = "sdfs____#@$#@$#@$@#$__dfd这两个效果一摸一样";
}
}
}
});
</script>
</html>
以上就是关于angularJS 中$scope方法使用指南的全部内容了,希望大家能够喜欢。
相关文章
Angular 2父子组件数据传递之@Input和@Output详解 (上)
这篇文章主要给大家介绍了关于Angular 2父子组件数据传递之@Input和@Output的相关资料,文中通过示例代码介绍的非常详细,对大家具有一定的参考学习价值,需要的朋友们下面跟着小编一起来看看吧。2017-07-07
详解Angular中的自定义服务Service、Provider以及Factory
本篇文章主要介绍了详解Angular中的自定义服务Service、Provider以及Factory,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2017-04-04
Angular Component属性绑定target和attr.target的区别分析
这篇文章主要介绍了Angular Component属性绑定target和attr.target的区别分析,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪2023-07-07


最新评论