Use this function to manually start up angular application.
Angular will detect if it has been loaded into the browser more than once and only allow the first loaded script to be bootstrapped and will report a warning to the browser console for each of the subsequent scripts. This prevents strange results in applications, where otherwise multiple instances of Angular try to work on the DOM.
用法:angular.bootstrap(element, [modules]);
Creates a deep copy of source, which should be an object or an array.
· If no destination is supplied, a copy of the object or array is created.
· If a destination is provided, all of its elements (for array) or properties (for objects) are deleted and then all elements/properties from the source are copied to it.
· If source is not an object or array (inc. null and undefined), source is returned.
· If source is identical to 'destination' an exception will be thrown.
Wraps a raw DOM element or HTML string as a jQuery element.
把原生的DOM元素或者HTML字符串作包装成JQuery元素
Deserializes a JSON string.(反序列化json字符串)
Creates an injector function that can be used for retrieving services as well as for dependency injection (seedependency injection).
Determines if a reference is an Array.
Determines if a value is a date.
Determines if a reference is defined.
Determines if a reference is a DOM element (or wrapped jQuery element).
Determines if a reference is a Number.
Determines if a reference is a String.
Determines if a reference is undefined.
Converts the specified string to lowercase/uppercase.
Serializes input into a JSON-formatted string. Properties with leading $ characters will be stripped since angular uses this notation internally.
A module is a collection of services, directives, controllers, filters, and configuration information. angular.module is used to configure the$injector.
// 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('!');
}]);
Then you can create an injector and load your modules like this:
var injector = angular.injector(['ng', 'myModule'])
However it's more likely that you'll just use ngApp or angular.bootstrap
to simplify this process for you.
angular.module(name, [requires], [configFn]);
Param | Type | Details |
---|---|---|
name | string | The name of the module to create or retrieve. |
requires
(optional)
|
!Array. |
If specified then new module is being created. If unspecified then the module is being retrieved for further configuration. |
configFn
(optional)
|
Function= | Optional configuration function for the module. Same as Module#config(). |
module | new module with the |
以上内容整理了官网