You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now that we have our main Object let's start playing with it.
@@ -551,6 +551,8 @@ You can set this to either `true` or `false`. By default it's false. If set to t
551
551
552
552
You can set here if you want to URL Encode IDs or not. By default, it's true.
553
553
554
+
**[Back to top](#table-of-contents)**
555
+
554
556
### Accessing configuration
555
557
556
558
You can also access the configuration via `RestangularProvider` and `Restangular` via the `configuration` property if you don't want to use the setters. Check it out:
@@ -559,6 +561,8 @@ You can also access the configuration via `RestangularProvider` and `Restangular
559
561
Restangular.configuration.requestSuffix='/';
560
562
````
561
563
564
+
**[Back to top](#table-of-contents)**
565
+
562
566
### How to configure them globally
563
567
564
568
You can configure this in either the `config` or the `run` method. If your configurations don't need any other services, then I'd recommend you do them in the `config`. If your configurations depend on other services, you can configure them in the `run` using `Restangular` instead of `RestangularProvider`
### How to create a Restangular service with a different configuration from the global one
625
631
Let's assume that for most requests you need some configuration (The global one), and for just a bunch of methods you need another configuration. In that case, you'll need to create another Restangular service with this particular configuration. This scoped configuration will inherit all defaults from the global one. Let's see how.
There're some times where you want to use Restangular but you don't want to expose Restangular object anywhere. For those cases, you can actually use the `service` feature of Restangular.
@@ -700,6 +708,7 @@ These are the methods that can be called on the Restangular object.
700
708
***restangularizeElement(parent, element, route, queryParams)**: Restangularizes a new element
701
709
***restangularizeCollection(parent, element, route, queryParams)**: Restangularizes a new collection
702
710
711
+
**[Back to top](#table-of-contents)**
703
712
704
713
### Element methods
705
714
***get([queryParams, headers])**: Gets the element. Query params and headers are optionals
@@ -724,6 +733,8 @@ These are the methods that can be called on the Restangular object.
724
733
***withHttpConfig(httpConfig)**: It lets you set a configuration for $http only for the next call. Check the Local Config HTTP section for an example.
725
734
***save**: Calling save will determine whether to do PUT or POST accordingly
726
735
736
+
**[Back to top](#table-of-contents)**
737
+
727
738
### Collection methods
728
739
***getList([queryParams, headers]): Gets itself again (Remember this is a collection)**.
729
740
***get([id]): Gets one item from the collection by id**.
@@ -744,6 +755,8 @@ These are the methods that can be called on the Restangular object.
744
755
***clone()**: Copies the collection
745
756
***withHttpConfig(httpConfig)**: It lets you set a configuration for $http only for the next call. Check the Local Config HTTP section for an example.
746
757
758
+
**[Back to top](#table-of-contents)**
759
+
747
760
### Custom methods
748
761
***customGET(path, [params, headers])**: Does a GET to the specific path. Optionally you can set params and headers.
749
762
***customGETLIST(path, [params, headers])**: Does a GET to the specific path. **In this case, you expect to get an array, not a single element**. Optionally you can set params and headers.
@@ -1010,6 +1023,8 @@ Create custom methods for your models using Restangular.extendModel(). This is a
0 commit comments