Angular 方法

前端之家收集整理的这篇文章主要介绍了Angular 方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.angular.bootstrap

Usethisfunctiontomanuallystartupangularapplication.

Angularwilldetectifithasbeenloadedintothebrowsermorethanonceandonlyallowthefirstloadedscripttobebootstrappedandwillreportawarningtothebrowserconsoleforeachofthesubsequentscripts.Thispreventsstrangeresultsinapplications,whereotherwisemultipleinstancesofAngulartrytoworkontheDOM.

用法@H_403_11@angular.bootstrap(element,[modules]);

2.angualr.copy

Createsadeepcopyofsource,whichshouldbeanobjectoranarray.

·Ifnodestinationissupplied,acopyoftheobjectorarrayiscreated.

Ifadestinationisprovided,allofitselements(forarray)orproperties(forobjects)aredeletedandthenallelements/propertiesfromthesourcearecopiedtoit.

Ifisnotanobjectorarray(inc.nullandundefined),isreturned.

isidenticalto'destination'anexceptionwillbethrown.

3.angular.element

WrapsarawDOMelementorHTMLstringasajQueryelement.

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

4.angular.fromJson

DeserializesaJSONstring.反序列化json字符串

5.angular.injector

Createsaninjectorfunctionthatcanbeusedforretrievingservicesaswellasfordependencyinjection(seedependencyinjection).

6.angular.isArray

DeterminesifareferenceisanArray.

7.angular.isDate

Determinesifavalueisadate.

8.angular.isDefined

Determinesifareferenceisdefined.

9.angular.isElement

DeterminesifareferenceisaDOMelement(orwrappedjQueryelement).

10.angular.isNumber

DeterminesifareferenceisaNumber.

11.angular.isString

String.

12.angular.isUndefined

Determinesifareferenceisundefined.

13.angular.lowercase/angular.uppercase

Convertsthespecifiedstringtolowercase/uppercase.

14.angular.toJson

SerializesinputintoaJSON-formattedstring.Propertieswithleading$characterswillbestrippedsinceangularusesthisnotationinternally.

15.angualr.module

Amoduleisacollectionofservices,directives,controllers,filters,andconfigurationinformation.angular.moduleisusedtoconfigurethe$injector.

// Create a new module var myModule = angular.module('myModule', []); // register a new service myModule.value'appName' 'MyCoolApp');// configure existing services inside initialization blocks.config(['$locationProvider'function($locationProvider){// Configure existing providers $locationProviderhashPrefix'!'}]);

Then you can create an injector and load your modules like this:

 injector injector'ng'])

However it's more likely that you'll just usengApporangularbootstrapto simplify this process for you.


Usage

name[requires],51)">configFn]);

Arguments

@H_175_301@ Type
Param 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 asModule#config().

Returns

module

new module with the.Moduleapi.


以上内容整理了官网

猜你在找的Angularjs相关文章