stored in JS and used to interact with the user.
Scope (SCOPE): The
scope in which model data is produced in an HTML page.
expression (expression):
Angularjs syntax that can be calculated on an HTML page.
Compiler (Compiler):
is used to interpret angular code in HTML code.
Filter:
Displays the data that is output in an HTML page in a specified format.
View:
T
},function () { $rootScope .user=user; });
Read the user data this side, the use of $resource service encapsulation, here is not said.
Authorization processing in the request process
Next is a more important point, how to inject authorize information into each request header after landing, using interceptors.
There is a problem, if because of the refresh too fast, detect user callback has not finished, this time access to all interfaces are 401, where the need to inject the interceptor on the $
First, the start-up phase
As you all know, when a browser loads an HTML page, it parses the HMTL page into a DOM tree, and then loads each element node in the DOM tree one at a time. We can use the Angularjs as a jquery-like JS Library, we introduce
Second, the stage of initialization
When angular starts, it looks for the Ng-app instructions, initializes a series of necessary components (i.e., $injector, $compile Services, and $rootscope), and the
constructor, pulling out the task of creating the module from within another module. The object is created elsewhere and passed to another object as a constructor parameter.But new problems have arisen. If we cannot create other modules within the module, then there must be a place to initialize the modules. Also, if the constructor of the module that we need to create contains a large number of dependent parameters, the code will become ugly and difficult to read, and there will be a large num
Previous blog (iii) the use of Ng-app and the automatic loading of the ANGULARJS framework presented the use of Ng-app directives. It was strange to think of the 4th and 5th cases, because we saw only the phenomenon and didn't see the essence. JS error, the most intuitive way to behave is: pop up a very unfriendly JS error window. The browser will not pop up the error message when the script has an uncaught error. There is also a more obscure indication: output error messages in the browser's co
In angular, the Directive, Service, Filter, and Controller are given in a factory way, and the parameter name of the factory method corresponds to the Service that the factory method relies on. Such as:App.controller (' Wolrdctrl ', function ($scope, $http) {//...}); in the above function before execution, Angular Injector generates a $scope instance of and $http An instance of and pass in the method. If you want to compress JS, then the paramete
, as if the last line was commented out:Phonelistctrl. $inject = [' $scope ', ' $http '];Another method can also be used to specify a dependency list and avoid compression problems-using a JavaScript array to construct the controller: placing the service to be injected into a string array (representing the dependent name), the last element of the array is the Controller's method function:var Phonelistctrl = [' $scope ', ' $http ', function ($scope, $http) {/* Constructor body */}];This is Angula
). AnnotatedWith (Names. named ("width ")). ToInstance (100 );Bind (Integer. class). AnnotatedWith (Names. named ("height ")). ToInstance (120 );Run this example to get the same result as the previous example. When using Injector to construct a MyRectangle instance, Injector automatically selects the constructor with parameters and uses 100,120 as the width and height injection parameters. A MyRectangle obj
in a hierarchical manner. For a specific directory namespace, LDAp only allows one master server.
Replication is driven by the OpenLDAp replication daemon slurpd. Slurpd runs regularly to check the log files of the master server for any updates. Then, push the update to the slave server. READ requests can be responded by any server, and updates can only be executed by the master server. A reference message is generated for an update request from the slave server, which provides the address o
an HTML node reference. You can easily create a 'targetnode' using 'document. querySelector'
2: view the scope tree
Sometimes, we need to view the scope level on the page to effectively debug our application. AngularJS Batarang is an extension of the Chrome browser we need. It can display the current scope level and has other very useful features.
3: capture any service
No matter where the ngApp is defined, we can use the injector function to captur
exists, then directly return modules[name] , in this case, angular.module the role is equivalent to a getter. If angular.module(name, requires[, configFn]) called by, it is used as a setter to register a module.The code for module registration is as follows:function() { varInvokequeue = []; varConfigblocks = []; varRunblocks = []; varConfig = invokelater (' $injector ', ' invoke ', ' push ', configblocks); varModuleinstance ={_invokequeue:invokequ
modification of the model, this command must be done by bringing the $apply method into the angular execution environment. Only the model changes in the $apply method are correctly angular counted. For example, a directive listens for DOM events, such as Ng-click, which must evaluate an expression in the $apply method.After evaluating the expression, the $apply method executes a $digest. In the $digest phase, scope checks all $watch listening expressions, comparing the current value to the old
an HTML node reference. You can easily create a 'targetnode' using 'document. querySelector'
2: view the scope tree
Sometimes, we need to view the scope level on the page to effectively debug our application. AngularJS Batarang is an extension of the Chrome browser we need. it can display the current scope level and has other very useful features.
3: capture any service
No matter where the ngApp is defined, we can use the injector function to captur
ANGULARJS is a structural framework designed for dynamic Web applications that is designed to overcome the shortcomings of HTML in building applications.Working principle:1 load the HTML and parse it into DOM;2 loading angular.js scripts;3 Angularjs wait for domcontentloaded event to trigger;4 Angularjs look for the NG-APP directive to determine the application boundary according to this directive;5 Use the module specified in Ng-app to configure the $inject
-up and execution process, such as:1) The browser loads the static HTML file and parses it into DOM;2) Browser loading angular.js file;3) Angular monitoring DOMContentLoaded events, monitoring to start;4) Angular look for Ng-app directive, determine the scope of action;5) Find the module defined in the app using the $injector service for dependency injection;6) Create $compile service for compiling according to $i
specified to this route.The problem is that we say we can delay loading a secondbackendservice, using a completely different implementation: This will rewrite the first one! There is currently no way to do the same name with two different implementations of two services, which prevents a secure way to implement lazy loading from Angular 1. Angular 1.x multi-Dependency injection mechanismIn Angular 1, we can use different methods for injection in multiple places:By location injection in the link
reasonable direction, perhaps Ng's designers do not want to let the template become a simple view layer, is to enhance the HTML, let it have a little business capability. It seems to be able to think that way, OK, first deceive yourself ~V. Special NG-SRC and Ng-hrefBefore explaining the special requirements of these two instructions, you need to know about Ng's start-up and execution process, such as:1) The browser loads the static HTML file and parses it into DOM;2) Browser loading angular.js
This article may not be updated regularly, the main record of this period of time in the ANGULARJS learning to develop some of the problems of the solution. This article to excerpt mainly, the main purpose or the confusion of their own in various places to find the solution of the summary, to leave a memo for themselves.1, novice in the initial use of Angularjs router often forget to refer to angular-route.min.js and injection related dependencies, resulting in similar uncaught Error: [ $
given as a factory method, and the parameter name of the factory method corresponds to the service that the factory method relies on.Such as:App.controller (' Myctrl ', function ($scope, $http) { //...})Before the above function executes, Angular injector will generate a $scope instance and $http instance, and pass in the method, if you want to handle the JS compression, then the parameter name may change. Angular
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.