zoukankan      html  css  js  c++  java
  • angular.module

    angular.module()创建、获取、注册angular中的模块,

    创建:两个或更多参数

    获取:只有一个参数

    The angular.module() is a global place for creating, registering and retrieving Angular modules.When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved。

    // 传递参数不止一个,代表新建模块;空数组代表该模块不依赖其他模块
    var createModule = angular.module("myModule", []);
    
    // 只有一个参数(模块名),代表获取模块
    // 如果模块不存在,angular框架会抛异常
    var getModule = angular.module("myModule");
    
    // true,都是同一个模块
    alert(createModule == getModule);
    // Create a new module
    var myModule = angular.module('myModule', []);
    
    // register a new service
    myModule.value('appName', 'MyCoolApp');
    
    // configure existing services inside initialization blocks.
    myModule.config(['$locationProvider', function($locationProvider) {
      // Configure existing providers
      $locationProvider.hashPrefix('!');
    }]);

    可参考:

    http://www.mamicode.com/info-detail-247448.html

    http://docs.angularjs.cn/api/ng/function/angular.module

  • 相关阅读:
    3513: [MUTC2013]idiots
    ELK+Filebeat+Kafka+ZooKeeper 构建海量日志分析平台(elk5.2+filebeat2.11)
    【python全栈开发】初识python
    SQL疑难问题
    费用分摊问题
    透过现象看本质
    关于python3round与float的四省五入精度的问题
    Win10下VSCode安装PlantUML
    安装pymssql
    ensorFlow的安装
  • 原文地址:https://www.cnblogs.com/simonbaker/p/5220840.html
Copyright © 2011-2022 走看看