I couldn't find any examples of using an $update PUT method in Angular when using ui-router instead of ngRoute for routing. Is an $update PUT method possible when using ui-router?
相关问题
- angularJS: ui-router equivalent to $location.searc
- Separate AngularJS Controllers Into Separate Files
- Angular ngAnimate not working first time on page l
- Ionic Spinner not showing up
- Upload file to Google Cloud Storage using AngularJ
相关文章
- Passing variable through URL with angular js
- Watch entire object (deep watch) with AngularJS
- Angular ng-if change span text
- Can ng-show directive be used with a delay
- AngularJS $routeParams vs $stateParams
- Multiple parameters in AngularJS $resource GET
- How to set class/style of accordion heading in Ang
- PUT to S3 with presigned url gives 403 error
The
$update
method in the example you linked in the question comments has nothing to do with$routeParams
or$stateParams
. Those (in most cases) just refer the parameters that are present within the url.As an example, if you declared a url in your config as:
/#/foo/:id/bar
and you visited the url:/#/foo/5/bar?hello=world&verified=1
then$routeParams
and$stateParams
would be an object that looks like:Note: In the case of $stateParams, I think the url in the config might need to be declared as:
/foo/:id/bar?hello&verified
As for the
$update
method andPUT
requests, these are related to the angular-resource module. You'll notice from the example you cited that a service (factory) was declared that makes use of the$resource
service. if you take a look at the docs specifically under the Returns section you'll see that the$resource
service will return:It further states:
So
$save
,$remove
,$delete
are avaiable but no $update. This is why the service in the example has the line:It's meant to extend these default set of actions so that
$update
will be available as a method on the objects and it will use the HTTP PUT method instead of GET/POST/DELETE like the others.I sugggest you do further reading on $routeParams, $stateParams and ngResource but hopefully the distinction between them is clear.