©
This document uses PHP Chinese website manual Release
Interface for configuring angular modules.
Provider(名称, providerType);
参见 $provide.provider().
参数 | 类型 | 详述 |
---|---|---|
name | string |
service name |
providerType | Function |
Construction function for creating new instance of the service. |
factory(名称, providerFunction);
参见 $provide.factory().
参数 | 类型 | 详述 |
---|---|---|
name | string |
service name |
providerFunction | Function |
Function for creating new instance of the service. |
Service(名称, constructor);
参见 $provide.service().
参数 | 类型 | 详述 |
---|---|---|
name | string |
service name |
constructor | Function |
A constructor function that will be instantiated. |
value(名称, Object);
参见 $provide.value().
参数 | 类型 | 详述 |
---|---|---|
name | string |
service name |
object | * |
Service instance object. |
constant(名称, Object);
Because the constant are fixed, they get applied before other provide methods. See $provide.constant().
参数 | 类型 | 详述 |
---|---|---|
name | string |
constant name |
object | * |
Constant value. |
animation(名称, animationFactory);
注意: animations take effect only if the ngAnimate module is loaded.
Defines an animation hook that can be later used with $animate service and directives that use this service.
module.animation('.animation-name', Function($inject1, $inject2) {
return {
eventName : Function(element, done) {
//code to run the animation
//once complete, then run done()
return Function cancellationFunction(element) {
//code to cancel the animation
}
}
}
})
参见 $animateProvider.register() and ngAnimate module for more information.
参数 | 类型 | 详述 |
---|---|---|
name | string |
animation name |
animationFactory | Function |
Factory function for creating new instance of an animation. |
Filter(名称, filterFactory);
参见 $filterProvider.register().
参数 | 类型 | 详述 |
---|---|---|
name | string |
Filter name. |
filterFactory | Function |
Factory function for creating new instance of filter. |
controller(名称, constructor);
参见 $controllerProvider.register().
参数 | 类型 | 详述 |
---|---|---|
name | stringObject |
Controller name, or an object map of controllers where the keys are the names and the values are the constructors. |
constructor | Function |
Controller constructor function. |
Directive(名称, directiveFactory);
参见 $compileProvider.directive().
参数 | 类型 | 详述 |
---|---|---|
name | stringObject |
Directive name, or an object map of directives where the keys are the names and the values are the factories. |
directiveFactory | Function |
Factory function for creating new instance of directives. |
config(configFn);
Use this method to register work which needs to be performed on module loading. For more about how to configure services, see Provider Recipe.
参数 | 类型 | 详述 |
---|---|---|
configFn | Function |
Execute this function on module load. Useful for service configuration. |
run(initializationFn);
Use this method to register work which should be performed when the injector is done loading all modules.
参数 | 类型 | 详述 |
---|---|---|
initializationFn | Function |
Execute this function after injector creation. Useful for application initialization. |
requires
Holds the list of modules which the injector will load before the current module is loaded. |
名称