Local storage in the HTML5
Localstorage: Always stored on-premises
Sessionstorage: With the session, the window is closed.
Usage: Localstorage.setitem ("Key", "value")//Set Variable
Localstorage.getitem ("key")//Get variable
Localstorage.removeitem ("key")//Clear variable
The difference between scope and rootscope in Angularjs
Scope: For data binding between a single HTML and a controller
Rootscope: The values defined therein can be used in each controller
Use $root.key in all templates.
The $resource in Angularjs
The factory that created the resource object. Allow interaction with server-side data resources
Usage of $resource:
$resource (url,[paramdefaults],[actions],options);
Url:url template, parameters to: prefix, such as Http://example.com/resource/:resource_id.:format
The default value in the Paramdefault:url parameter, JSON format, such as
{
Callback: ' Json_callback ',
Stamp:Date.now () + "+ math.random (),
Action: ' @action '
}
Action: Declares a custom action collection that extends the default resource action collection
{action1: {method:?, params:?, IsArray:?, headers:?, ...},
Action2: {method:?, params:?, IsArray:?, headers:?, ...},
...}
Where: Action is the action name and is the method name of the resource object
Method:http Request Method (Get,post,jsonp ... )
Params: Parameters that are bound in advance
Use of $resource:
Assuming that it has a parameter ID in its URL,
. Factory (' Order ', [' $resource ', function ($resource) {
Return $resource ('/v1/order/:id ', {id: ' @id '}
}
. Controller (' XXX ', [' $scope ', ' Order ', function () {
$scope. Order = Order.get ({ID: $routeParams. ID});
}])
Use of extends
QS = Angular.extend (qs, {type: ' Pguid '});
Adds a new element to the QS object.
Built-in service $location
Exposing URLs in the browser's address bar
Use: Get URL:
$location. Path ();
To change the URL:
$location. Path ('/value ')
Get the variables for Get transfer:
var search = $location. Search ();
Search.force//url?force=1
When we call the URL () method,
Returns the encoded URLs that contain the path, search, and hash sections.
such as/path?search=1&b=c#hash.