Angular 方法

1. angular.bootstrap

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]);

 

2. angualr.copy

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.

3. angular.element

Wraps a raw DOM element or HTML string as a jQuery element.

把原生的DOM元素或者HTML字符串作包装成JQuery元素

4.angular.fromJson

Deserializes a JSON string.反序列化json字符串

5.angular.injector

Creates an injector function that can be used for retrieving services as well as for dependency injection (seedependency injection).

6.angular.isArray

Determines if a reference is an Array.

7.angular.isDate

Determines if a value is a date.

8. angular.isDefined

Determines if a reference is defined.

9.angular.isElement

Determines if a reference is a DOM element (or wrapped jQuery element).

10.angular.isNumber

Determines if a reference is a Number.

11.angular.isString

Determines if a reference is a String.

12.angular.isUndefined

Determines if a reference is undefined.

13.angular.lowercase/angular.uppercase

Converts the specified string to lowercase/uppercase.

14.angular.toJson

Serializes input into a JSON-formatted string. Properties with leading $ characters will be stripped since angular uses this notation internally.

15. angualr.module

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.


Usage

angular.module(name, [requires], [configFn]);

Arguments

Param Type Details
name string

The name of the module to create or retrieve.

requires
(optional)
!Array.<string>=

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().

Returns

module

new module with the angular.Module api.


以上内容整理了官网


 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值