0003-Program Flow 1

Source: Internet
Author: User

Various dependent files are introduced into the index.html

Angular JS management starts at Ng-app

1Angular.module (' App ', [' '])2. Run (function($rootScope,...) {3      4      //make some basic settings at the root scope5$rootScope. ENV =ENV;6$rootScope. VERSION =VERSION;7     8     //listen for the start of the routing change and do some action with the callback function9$rootScope. $on (' $stateChangeStart ',function(event, ToState, Tostateparams) {Ten              One             //Save the route that will be accessed in the root scope for subsequent access by the program A$rootScope. tostate =tostate; -$rootScope. Tostateparams =Tostateparams; -  the             //some permission decisions can be made here -              -             //If internationalization is required, you can update the current user's language options here -  +     }); -      +     //When routing changes are complete, do what you need to do A$rootScope. $on (' $stateChangeSuccess ',function(event, ToState, Toparams, FromState, fromparams) { at             -  -             //Here you can save the previous route to the root scope, or depending on the requirements -             //does not save the route to the login page or the registration page.  -  -             //The values of some page header fields are also updated here, which can be saved in the route and obtained when the event is triggered.  in              -              to     }); +      -     //Here you can write some common methods to use in a child scope the     //For example, set a method to return to the home page *$rootScope. GoHome =function(){ $         //Back to HomePanax Notoginseng$state. Go (' Home '); -     } the      +      A      the }) +. config (function($stateProvider, $httpProvider, $urlRouterProvider, XXX) { -     //sets the access/status route if stateless access is enabled.  $$urlRouterProvider. Otherwise ('/'); $     //to configure some common routes - $stateProvider. State (XXX). State (XXX); -      the     //inject some HTTP requests, for example, by adding permission authentication before sending a message , -     //when receiving the message, do some special data extraction. or broadcast an exception event when 400 requests are receivedWuyi$httpProvider. Interceptors.push (' XXX ')); the      -     //to do some other modular configuration Wu})

0003-Program Flow 1

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.