1.angular 里 字符串與對象互轉
angular.toJson();將字符串轉成對象
angular.forJson(); 將字符串轉成對象
2.angular 循環
<script src="../js/angular.min.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> var json = { "name":"jack", "age":20 } var arr = []; // angular 循環 value key angular.forEach(json,function(val,key){ this.push(val + ':' +key); },arr); console.log(arr) </script>
4.手動啟動angular的方法 也可開啟多個模塊
angular.element(document).on('click',function(){
angular.bootstrap(document,['mk'])
})
5.app.run(); 可以不使用控制器就開啟數據,但適合$rootscope;
app.run([
'rootScope'
,function($rootScope){
}])
6.disable : true ,禁用
7.$watch監聽
$scope.$watch(
'要監聽的對象'
,function(newVal,oldVal){
},
true
)
true
深度監聽