angular.module()

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title>angular.module</title>
    </head>

    <body ng-app="moduleExample">
        <h1>angular.module</h1>
        <p>
            <span>描述:</span><br />
            <span>用angular.module来检索和注册模块。</span>
        </p>
        <p>
            <span>使用方法:</span><br />
            <span>angular.module(name, [requires], [configFn])</span>
        </p>
        <p>
            <span>参数:</span><br />
            <span>name:string, 创建或者检索模块的名称(ng-app)</span><br />
            <span>requires:array, 如果指定了新模块,正在创建,如果没有指定,则该模块将被检索用来进一步配置。</span><br />
            <span>configFn:array, 模块的可配置功能</span><br />
        </p>
        <p>
            <span>返回值:</span><br />
            <span>module对象</span>
        </p>
        <hr />
        <div ng-controller="modulecon">
            <div id="test">{{vals}}</div>
        </div>
    </body>
    <script src="../../js/angular.1.3.0.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        angular.module('moduleExample', []).controller('modulecon', ['$scope', function($scope) {
            $scope.vals = '模块功能配置或者检索';
        }])
    </script>

</html>

 

posted @ 2018-10-10 16:01  谭翔随笔  阅读(235)  评论(0编辑  收藏  举报