加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angular 方法

发布时间:2020-12-17 10:08:27 所属栏目:安全 来源:网络整理
导读:1.angular.bootstrap Usethisfunctiontomanuallystartupangularapplication. Angularwilldetectifithasbeenloadedintothebrowsermorethanonceandonlyallowthefirstloadedscripttobebootstrappedandwillreportawarningtothebrowserconsoleforeachofthesubsequ

1.angular.bootstrap

Usethisfunctiontomanuallystartupangularapplication.

Angularwilldetectifithasbeenloadedintothebrowsermorethanonceandonlyallowthefirstloadedscripttobebootstrappedandwillreportawarningtothebrowserconsoleforeachofthesubsequentscripts.Thispreventsstrangeresultsinapplications,whereotherwisemultipleinstancesofAngulartrytoworkontheDOM.

用法: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

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 asModule#config().

Returns

module

new module with the.Moduleapi.


以上内容整理了官网

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读