zoukankan      html  css  js  c++  java
  • angularjs 的引人

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title></title>
    <script src="js/angular.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
    </head>

    <body ng-app = 'moduleOne'>
    <!--模块控制的范围-->
    <div ng-controller="indexC">
    <p>{{name}}</p>
    <p>{{obj.a}}</p>
    </div>

    <div ng-controller="indexD">
    <p>{{name}}</p>
    </div>
    <div ng-controller="indexE">
    <p>{{name}}</p>
    </div>

    </body>
    <script type="text/javascript">
    console.log(angular);
    //定义第一个模块,2个参数模块名,数组(引人其他模块的名字)
    // 定义一个控制器名,与一个函数
    angular.module('moduleOne',[]).controller('indexC',function($scope){
    $scope.name = 'laoxie';
    $scope.obj = {
    a:'1',
    b:'2'
    };

    $scope.num =10;

    }).controller('indexD',function($scope){

    $scope.name = 'laoyao';
    }).controller('indexE',function($scope){
    $scope.name = 'laohe';
    })





    </script>
    </html>

  • 相关阅读:
    MYSQL[18]
    MYSQL[11]
    hdu 1847
    hdu 2149
    uva 10341
    hdu 1850
    uva 10391字典树
    hdu 2473
    uva 10761
    hdu 1198
  • 原文地址:https://www.cnblogs.com/taozi123/p/6393231.html
Copyright © 2011-2022 走看看