mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-13 17:23:11 +00:00
docs(): fix jshint issues
This commit is contained in:
parent
3174f73336
commit
6ac773f350
1 changed files with 26 additions and 25 deletions
|
|
@ -276,31 +276,32 @@ function shallowClearAndCopy(src, dst) {
|
||||||
* @example
|
* @example
|
||||||
* # 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
|
||||||
<pre>
|
* <pre>
|
||||||
var app = angular.module('app', ['ngResource', 'ngRoute']);
|
* var app = angular.module('app', ['ngResource', 'ngRoute']);
|
||||||
|
*
|
||||||
// Some APIs expect a PUT request in the format URL/object/ID
|
* // Some APIs expect a PUT request in the format URL/object/ID
|
||||||
// Here we are creating an 'update' method
|
* // Here we are creating an 'update' method
|
||||||
app.factory('Notes', ['$resource', function($resource) {
|
* app.factory('Notes', ['$resource', function($resource) {
|
||||||
return $resource('/notes/:id', null,
|
* return $resource('/notes/:id', null,
|
||||||
{
|
* {
|
||||||
'update': { method:'PUT' }
|
* 'update': { method:'PUT' }
|
||||||
});
|
* });
|
||||||
}]);
|
* }]);
|
||||||
|
*
|
||||||
// In our controller we get the ID from the URL using ngRoute and $routeParams
|
* // In our controller we get the ID from the URL using ngRoute and $routeParams
|
||||||
// We pass in $routeParams and our Notes factory along with $scope
|
* // We pass in $routeParams and our Notes factory along with $scope
|
||||||
app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes', function($scope, $routeParams, Notes) {
|
* app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',
|
||||||
// First get a note object from the factory
|
function($scope, $routeParams, Notes) {
|
||||||
var note = Notes.get({ id:$routeParams.id });
|
* // First get a note object from the factory
|
||||||
$id = note.id;
|
* var note = Notes.get({ id:$routeParams.id });
|
||||||
|
* $id = note.id;
|
||||||
// Now call update passing in the ID first then the object you are updating
|
*
|
||||||
Notes.update({ id:$id }, note);
|
* // Now call update passing in the ID first then the object you are updating
|
||||||
|
* Notes.update({ id:$id }, note);
|
||||||
// This will PUT /notes/ID with the note object in the request payload
|
*
|
||||||
}]);
|
* // This will PUT /notes/ID with the note object in the request payload
|
||||||
</pre>
|
* }]);
|
||||||
|
* </pre>
|
||||||
*/
|
*/
|
||||||
angular.module('ngResource', ['ng']).
|
angular.module('ngResource', ['ng']).
|
||||||
factory('$resource', ['$http', '$q', function($http, $q) {
|
factory('$resource', ['$http', '$q', function($http, $q) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue