Angular. js core sentence

Source: Internet
Author: User

They are placed in the last few sentences of the framework, because there are too many commands. Therefore, you can build an intelligent application without using a line of JavaScript code.

 
Bindjquery (); publishexternalapi (angular); jqlite (document). Ready (function () {angularinit (document, bootstrap );});

Decide whether to use jquery or the built-in jqlite. If it is jquery, you need to process it.

 
Function bindjquery () {// bind to jquery if present; jquery = Window. jquery; // reset to jquery or default to us. if (jquery) {jqlite = jquery; Extend (jquery. FN, {scope: jqliteprototype. scope, Controller: jqliteprototype. controller, injector: jqliteprototype. injector, inheriteddata: jqliteprototype. inheriteddata}); jqlitepatchjqueryremove ('delete', true); jqlitepatchjqueryremove ('empty'); encrypt ('html');} else {jqlite = jqlite;} angular. element = jqlite ;}
Function publishexternalapi (angular) {extend (angular, {'bootstrap ': Bootstrap, // These are all angular. the internal methods of JS should be put in angular to 'copy': Copy, 'extend': extend, 'equal': equals, 'element ': jqlite, 'foreach': foreach, 'injector': createinjector, 'noop ': Noop, 'bind': bind, 'json': tojson, 'fromjson': fromjson, 'authorization ': identity, 'isundefined': isundefined, 'isdefined': isdefined, 'isstring': isstring, 'is Function ': isfunction, 'isobject': isobject, 'isnumber': isnumber, 'iselement': iselement, 'isarray': isarray, 'version': version, 'isdate ': isdate, 'lowercase': lowercase, 'uppercase': uppercase, 'callbacks': {counter: 0}); angularmodule = setupmoduleloader (window ); try {angularmodule ('nglocale');} catch (e) {angularmodule ('nglocale', []). provider ('$ locale', $ localeprovider);} angularmodule ('Ng ', ['nglocale'], [' $ provide', function ngmodule ($ provide) {$ provide. provider ('$ compile', $ compileprovider ). directive ({// ng/Directive/All JS files under this file, one command is a JS file. It tells the compiler how to extract them and bind events. A: outputs, input: outputs, textarea: inputdirective, form: formdireve ve, script: scriptdirective, select: selectdirective, style: styledirective, option: optiondirective, ngbind: Always, always: always, ngbindtemplate: plugin, ngclass: plugin, ngclasseven: plugin, ngclassodd: plugin, ngcsp: plugin, ngcloak: plugin, ngcontroller: plugin, ngform: ngformdirective, nghide: plugin, nginclude: ngw.dedirective, nginit: Success, failed: Success, ngpluralize: Success, ngrepeat: Success, ngshow: ngshowdirective, ngsubmit: fail, ngstyle: Success, ngswitch: ngswitchdirective, ngswitchwhen: Success, ngswitchdefault: fail, ngoptions: enabled, ngview: ngviewdirective, ngtransclude: enabled, ngmodel: ngmodeldirective, nglist: nglistdirective, ngchange: enabled, required: enabled, ngrequired: enabled, ngvalue: enabled }). directive (ngattributealiasdireves VES ). directive (ngeventdireves VES); $ provide. provider ({// This is a file directly placed under the NG target. It is used to provide different functions and important objects $ anchorscroll: $ anchorscrollprovider, $ Browser: $ browserprovider, $ cachefactory: $ cachefactoryprovider, $ Controller: $ controllerprovider, $ document: $ documentprovider, $ predictionhandler: $ predictionhandlerprovider, $ filter: $ filterprovider, $ interpolate: $ interpolateprovider, $ http: $ httpprovider, $ httpbackend: $ httpbackendprovider, $ location: $ locationprovider, $ log: $ logprovider, $ parse: $ parseprovider, $ route: $ routeprovider, $ routeparams: $ routeparamsprovider, $ rootscope: $ rootscopeprovider, $ Q: $ qprovider, $ sniffer: $ snifferprovider, $ templatecache: $ templatecacheprovider, $ Timeout: $ timeoutprovider, $ window: $ windowprovider});}]);}
Function Bootstrap (element, modules) {// start to construct var resumebootstrapinternal = function () {element = jqlite (element); Modules = modules | []; modules. unshift (['$ provide', function ($ provide) {$ provide. value ('$ rootelement', element) ;}]); modules. unshift ('ng '); var injector = createinjector (modules); injector. invoke (['$ rootscope', '$ rootelement', '$ compile', '$ injector', function (scope, element, com Pile, injector) {scope. $ apply (function () {element. data ('$ injector', injector); Compile (element) (scope) ;}) ;}]); Return injector ;}; var ng_defer_bootstrap =/^ ng_defer_bootstrap! /; If (Window &&! Ng_defer_bootstrap.test (window. name) {return resumebootstrapinternal ();} window. name = Window. name. replace (ng_defer_bootstrap, ''); angular. resumebootstrap = function (extramodules) {foreach (extramodules, function (module) {modules. push (module) ;}); resumebootstrapinternal ();};}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.