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

  • 相关阅读:
    主键索引就是聚集索引吗?
    聚集索引以及非聚集索引
    IO阻塞模型、IO非阻塞模型、多路复用IO模型
    Log4j的使用说明
    前置机是什么
    转:图文理解区块链
    DQL、DML、DDL、DCL全名是啥?
    OLAP和OLTP的区别
    JAVA之运算符优先级
    JAVA之异常处理(一)
  • 原文地址:https://www.cnblogs.com/simonbaker/p/5220840.html
Copyright © 2011-2022 走看看