zoukankan      html  css  js  c++  java
  • angular中对象与字符串之间的转换

    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 深度监听
  • 相关阅读:
    NPM 重新回炉
    构建工具
    工作的环境部署
    Proxy 代理
    Promise 的 用法及实现
    JS 的 继承
    动态规划——LCS
    矩阵连乘——动态规划
    线段树&树状数组
    SpringAOP
  • 原文地址:https://www.cnblogs.com/w-xiaojia/p/7083210.html
Copyright © 2011-2022 走看看