Immediately following the first part:
Recommended reading: http://adrianmejia.com/blog/2014/10/03/mean-stack-tutorial-mongodb-expressjs-angularjs-nodejs/
SOURCE project: Git clone https://github.com/amejiarosario/todoAPIjs.git
First, the following angularjs is a model, a view, a controller
Model: Used to process data, including payees and setting data, generally refers to the operation of the database. Model defines the application layer data, which is independent of the user interface, in the ANGULARJS, the model application is very simple,
Can be understood as a model is an object.
View: In a Web application, views are HTML pages that are used to display model data. In Angularjs, the data is combined with the template engine, plus the ANGULARJS Directive (directives), which builds a
Rich HTML pages.
Controller: Controllers are used to manipulate the data in the model, and in ANGULARJS applications, the controller creates JavaScript functions through the Controllers () method. There may be multiple models and views in a module, controller
The role of link models and views.
Page Jump: Page jump requires design controller, template (view), Routing (Router)
where router by Angularjs in the $routeprovider, which is a service in Angularjs
$index: This is the index value of angular, generally with ng-repeat use
$http: $http is a built-in service for ANGULARJS, which allows you to communicate directly with the backend server. $http knowledge simply encapsulates the browser native XMLHttpRequest object.
$http Service is a function that can receive only one parameter. This parameter is an object that contains the configuration content used to generate the HTTP request;
$resource-based factory method:
$http is a fast network request service, ANGULARJS also provides another service----$rescouce. $resouce did a layer of encapsulation on the $http. Use it to handle
Resetfulapi will be much quicker.
$resource the method that has been encapsulated:
{'Get': {method:'GET'},//read a record 'Save': {method:'POST'},//Create record 'Query': {method:'GET', IsArray:true},//get list all records 'Remove': {method:'DELETE'},//Remove Record 'Delete': {method:'DELETE'} };//Same, remove record
The above is also missing a method is update, this method can be added in $resource
$resource (', NULL, {' Update ': {method: ' PUT '}
Small tips:
Jump page $location. URL ('/')
AngularJs Study (ii)