mirror of
https://github.com/danbee/mpd-client
synced 2025-03-04 08:39:09 +00:00
Update AngularJS.
This commit is contained in:
parent
d99ef48140
commit
ee0209783d
46
assets/javascripts/libs/angular-resource.js
vendored
Normal file → Executable file
46
assets/javascripts/libs/angular-resource.js
vendored
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @license AngularJS v1.2.14
|
* @license AngularJS v1.2.22
|
||||||
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
||||||
* License: MIT
|
* License: MIT
|
||||||
*/
|
*/
|
||||||
@ -99,10 +99,12 @@ function shallowClearAndCopy(src, dst) {
|
|||||||
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
|
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
|
||||||
* URL `/path/greet?salutation=Hello`.
|
* URL `/path/greet?salutation=Hello`.
|
||||||
*
|
*
|
||||||
* If the parameter value is prefixed with `@` then the value of that parameter is extracted from
|
* If the parameter value is prefixed with `@` then the value for that parameter will be extracted
|
||||||
* the data object (useful for non-GET operations).
|
* from the corresponding property on the `data` object (provided when calling an action method). For
|
||||||
|
* example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of `someParam`
|
||||||
|
* will be `data.someProp`.
|
||||||
*
|
*
|
||||||
* @param {Object.<Object>=} actions Hash with declaration of custom action that should extend
|
* @param {Object.<Object>=} actions Hash with declaration of custom action that should extend
|
||||||
* the default set of resource actions. The declaration should be created in the format of {@link
|
* the default set of resource actions. The declaration should be created in the format of {@link
|
||||||
* ng.$http#usage_parameters $http.config}:
|
* ng.$http#usage_parameters $http.config}:
|
||||||
*
|
*
|
||||||
@ -114,8 +116,8 @@ function shallowClearAndCopy(src, dst) {
|
|||||||
*
|
*
|
||||||
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
|
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
|
||||||
* your resource object.
|
* your resource object.
|
||||||
* - **`method`** – {string} – HTTP request method. Valid methods are: `GET`, `POST`, `PUT`,
|
* - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
|
||||||
* `DELETE`, and `JSONP`.
|
* `DELETE`, `JSONP`, etc).
|
||||||
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
|
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
|
||||||
* the parameter value is a function, it will be executed every time when a param value needs to
|
* the parameter value is a function, it will be executed every time when a param value needs to
|
||||||
* be obtained for a request (unless the param was overridden).
|
* be obtained for a request (unless the param was overridden).
|
||||||
@ -204,6 +206,9 @@ function shallowClearAndCopy(src, dst) {
|
|||||||
* On failure, the promise is resolved with the {@link ng.$http http response} object, without
|
* On failure, the promise is resolved with the {@link ng.$http http response} object, without
|
||||||
* the `resource` property.
|
* the `resource` property.
|
||||||
*
|
*
|
||||||
|
* If an interceptor object was provided, the promise will instead be resolved with the value
|
||||||
|
* returned by the interceptor.
|
||||||
|
*
|
||||||
* - `$resolved`: `true` after first server interaction is completed (either with success or
|
* - `$resolved`: `true` after first server interaction is completed (either with success or
|
||||||
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
|
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
|
||||||
* data-binding.
|
* data-binding.
|
||||||
@ -258,7 +263,7 @@ function shallowClearAndCopy(src, dst) {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
var User = $resource('/user/:userId', {userId:'@id'});
|
var User = $resource('/user/:userId', {userId:'@id'});
|
||||||
var user = User.get({userId:123}, function() {
|
User.get({userId:123}, function(user) {
|
||||||
user.abc = true;
|
user.abc = true;
|
||||||
user.$save();
|
user.$save();
|
||||||
});
|
});
|
||||||
@ -278,6 +283,16 @@ function shallowClearAndCopy(src, dst) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
*
|
||||||
|
* You can also access the raw `$http` promise via the `$promise` property on the object returned
|
||||||
|
*
|
||||||
|
```
|
||||||
|
var User = $resource('/user/:userId', {userId:'@id'});
|
||||||
|
User.get({userId:123})
|
||||||
|
.$promise.then(function(user) {
|
||||||
|
$scope.user = user;
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
* # Creating a custom 'PUT' request
|
* # Creating a custom 'PUT' request
|
||||||
* In this example we create a custom method on our resource to make a PUT request
|
* In this example we create a custom method on our resource to make a PUT request
|
||||||
@ -514,7 +529,7 @@ angular.module('ngResource', ['ng']).
|
|||||||
extend({}, extractParams(data, action.params || {}), params),
|
extend({}, extractParams(data, action.params || {}), params),
|
||||||
action.url);
|
action.url);
|
||||||
|
|
||||||
var promise = $http(httpConfig).then(function(response) {
|
var promise = $http(httpConfig).then(function (response) {
|
||||||
var data = response.data,
|
var data = response.data,
|
||||||
promise = value.$promise;
|
promise = value.$promise;
|
||||||
|
|
||||||
@ -522,15 +537,24 @@ angular.module('ngResource', ['ng']).
|
|||||||
// Need to convert action.isArray to boolean in case it is undefined
|
// Need to convert action.isArray to boolean in case it is undefined
|
||||||
// jshint -W018
|
// jshint -W018
|
||||||
if (angular.isArray(data) !== (!!action.isArray)) {
|
if (angular.isArray(data) !== (!!action.isArray)) {
|
||||||
throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected ' +
|
throw $resourceMinErr('badcfg',
|
||||||
|
'Error in resource configuration. Expected ' +
|
||||||
'response to contain an {0} but got an {1}',
|
'response to contain an {0} but got an {1}',
|
||||||
action.isArray?'array':'object', angular.isArray(data)?'array':'object');
|
action.isArray ? 'array' : 'object',
|
||||||
|
angular.isArray(data) ? 'array' : 'object');
|
||||||
}
|
}
|
||||||
// jshint +W018
|
// jshint +W018
|
||||||
if (action.isArray) {
|
if (action.isArray) {
|
||||||
value.length = 0;
|
value.length = 0;
|
||||||
forEach(data, function(item) {
|
forEach(data, function (item) {
|
||||||
|
if (typeof item === "object") {
|
||||||
value.push(new Resource(item));
|
value.push(new Resource(item));
|
||||||
|
} else {
|
||||||
|
// Valid JSON values may be string literals, and these should not be converted
|
||||||
|
// into objects. These items will not have access to the Resource prototype
|
||||||
|
// methods, but unfortunately there
|
||||||
|
value.push(item);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
shallowClearAndCopy(data, value);
|
shallowClearAndCopy(data, value);
|
||||||
|
|||||||
3319
assets/javascripts/libs/angular.js
vendored
Normal file → Executable file
3319
assets/javascripts/libs/angular.js
vendored
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user