Modular design
1. Refer to the custom module and call
In a custom module, if there are some services, encapsulating the funny module, in another module (at the time of declaration, add the module to be introduced in the dependency list)
var app02 = angular.module (' fan02 ', [' ng ', ' fan ']);
Call what is defined in the FAN02 module.
2.ng the use of built-in modules
(1) Ngroute module (routing module)
Angularjs is an open-source JS framework. Used in scenarios where data operations are more frequent, for spa applications
How single-page apps work:
1. Page url:http://127.0.0.1/index.html#/Routing Address
2. The browser first parses the underlying page index.html, and then resolves the routing address
3. Find the routing dictionary, #/startàstart.html#/mainàmain.html
4. Get the Real template page address for the address of the current URL
5. Initiate an AJAX request, get the target template page, insert into the current DOM tree
Steps to implement spa using Ngroute
1. Create a complete HTML page that introduces Angular.js, Angular-route.js
2. Create a custom module that relies on the Ng,ngroute in the dependency list
3. Declare a container in the body of the index.html (hold code snippet)
Implementation: Use the NGVIEW directive to declare a container
4. Create Code Snippets
5. Configure the Routing dictionary
$routeProvider. When ('/start ', {templateurl: ' start.html '});
6. Testing
Example: Re-correcting notes tomorrow morning
ANGULARJS Study notes the modular design of the four characteristics of 7--