angular.Module

Angular模块配置接口。

方法

provider(name,providerType);

name:服务名称。

providerType:创建一个服务的实例的构造函数。

factory(name,providerFunction);

name:服务名称。

providerFunction:创建服务的实例的函数。

service(name,constructor);

name:服务名称。

constructor:一个将被实例化的构造函数。

value(name,object);

name:服务名称。

object:服务实例对象。

constant(name,object);

name:常量名称。

object:常量值。

animation(name,animationFactory);

备注:animation只有在注入ngAnimate模块后才有效果。

定义一个稍后能在$animate服务或者注入此服务的指令中使用的动画。

name:动画名称。

animationFactory:创建动画的工厂函数。

filter(name,filterFactory);

name:过滤器名称。

filterFactory:创建一个过滤器的实例的工厂函数。

controller(name,constructor);

name:控制器名称。

constructor:控制器构造函数。

directive(name,directiveFactory);

name:指令名称。

directiveFactory:指令构造函数。

config(configFn);

使用这个方法来注册需要在模块加载时执行的动作。

configFn:在模块加载时执行这个函数。在服务配置时候较实用。

run(initializationFn);

使用这个方法来注册需要在所有模块都注入完成后执行的动作。

initializationFn:在注入创建后执行该函数。在应用程序初始化时很实用。

使用代码:

  angular.module("Demo", [])
.provider("demoProvider", ["dependency",function(dependency){
//your code
}])
.factory("demoFactory",["dependency",function(dependency){
//your code
}])
.service("demoService",["dependency",function(dependency){
//your code
}])
.value("demoValue",{
//your object
})
.constant("demoConstant",{
//your object
})
.animation(".demoAnimationName", ["dependency",function(dependency){
//your code
}])
.filter("demoFilter",["dependency",function(dependency){
//your code
}])
.controller("demoCtrl", ["dependency",function (dependency) {
//you code
}])
.directive("demoDirctive",["dependency",function (dependency) {
//you code
}])
.config(["dependency",function(dependency){
//your code
}])
.run(["dependency",function(dependency){
//your code
}])

这些都是对模块的配置,比如写上自己的controller,写上自己的service,或者写config配置啥的,这里感觉也没什么具体该介绍的,按照自己的项目写好这些配置即可了...

Angular - - angular.Module的更多相关文章

  1. Angular - - angular.injector、angular.module

    angular.injector 创建一个injector对象, 调用injector对象的方法可用于获取服务以及依赖注入. 格式:angular.injector(modules); modules ...

  2. angular js module 的理解

    module其实就是一个容器,里面可以装controller,service,directive,filter等, 官网的解释是:Module :A container for the differe ...

  3. angular自定义module

    在app.module.ts里面,imports部分,添加你的自定义模块名在你的自定义模块内,添加了component以后,需要添加exports导出,类似下面 import { NgModule } ...

  4. Angular - - Angular数据类型判断

    angular.isArray 判断括号内的值是否为数组. 格式:angular.isArray(value); value: 被判断是否为数组的值. ------------------------ ...

  5. Angular - - angular.bind、angular.bootstrap、angular.copy

    angular.bind 返回一个调用self的函数fn(self代表fn里的this).可以给fn提供参数args(*).这个功能也被称为局部操作,以区别功能. 格式:angular.bind(se ...

  6. Angular - - angular.element

    angular.element 将DOM元素或者HTML字符串一包装成一个jQuery元素. 格式:angular.element(element); element:包装成jquery对象的html ...

  7. Angular - - angular.identity和angular.noop

    angular.identity 函数返回本身的第一个参数.这个函数一般用于函数风格. 格式:angular.identity() 使用代码: (function () { angular.modul ...

  8. [Angular] Angular CDK Intro

    1. Installl latest @angular/cli: sudo npm i -g @angular/cli@next The version I used is:6.0.0-rc.10 2 ...

  9. [Angular] Angular CLI

    Create an app with routing config: ng new mynewapp --routing If you want to generate a new module wi ...

随机推荐

  1. SMB/CIFS协议解析

    1.SMB协议与CIFS协议的区别     139端口是一种TCP端口,该端口在通过网上邻居访问局域网中的共享文件或共享打印机时就能发挥作用.445端口也是一种TCP端口,该端口在 Windows 2 ...

  2. 3D动画效果照片墙demo

        <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF- ...

  3. zencart 掉炸天的tpl_main_page.php

    <?php /** * Common Template - tpl_main_page.php * * @version $Id: tpl_main_page.php 7085 2007-09- ...

  4. USACO 1.3.2

    题目链接:USACO 1.3.2 这道题有点小坑,不是算法错了,而是文件名,是barn1不是barnl,恕我眼拙,找了十五分钟... 肯定是木板的个数用的越多越好,这样可以减少空隙. 简单的贪心,将每 ...

  5. IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2) B. Bear and Compressing

    B. Bear and Compressing 题目链接  Problem - B - Codeforces   Limak is a little polar bear. Polar bears h ...

  6. ExtJS简介--车辆调度

    http://www.cnblogs.com/gaoweipeng/archive/2009/11/11/1599969.html

  7. JAVA基础-- 对象转型 (casting)

    1. 一个基类的引用类型变量可以指向其子类的对象: a=new Dog("bigyellow","yellow"); 2. 一个基类的引用不可以访问其子类对象新 ...

  8. ural1752 Tree 2

    Tree 2 Time limit: 1.0 secondMemory limit: 64 MB Consider a tree consisting of n vertices. A distanc ...

  9. mac 剪切文件

    首先选中文件,按Command+C复制文件:然后按Command+Option+V:就可以把你的文件剪走了!在这里补充一下,我这里讲的是剪切文件夹,不是剪切文本和文字!Command+X只能剪切文字文 ...

  10. JQuery中的mouseover和mouseenter的区别

    mouseover和mouseout是一对:mouseenter和mouseleave是一对. 相同点:都是鼠标经过就触发事件 不同点: 给外盒子一个经过触发事件,但是mouseover会在鼠标经过外 ...