--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/QA-irGz4zqM/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/QA-irGz4zqM/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
company.post("owners", $scope.userlist[i]).then(function(newOwner) {$scope.owners.push(newOwner);
}
To unsubscribe from this group and all its topics, send an email to angular+unsubscribe@googlegroups.com.
Hey,
You're welcome.
If you need any help with the blog post, please contact me.
Bests,
Gonto
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/QA-irGz4zqM/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
On Sunday, April 21, 2013 at 11:54 PM, Martin Gontovnikas wrote:
Hey,For the time being, you cannot handle this case with ResponseExtractor.Create an issue and I'll work with it. I don't know if it's worth sending the whole URL or just "what" you're getting.Bests,Gonto
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/QA-irGz4zqM/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/QA-irGz4zqM/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
var restangualrSpaces = Restangular.one("accounts",123).one("buildings", 456).all("spaces"); // This will do ONE get to /accounts/123/buildings/456/spaces restangularSpaces.getList() // This will do ONE get to /accounts/123/buildings/456/spaces/789 Restangular.one("accounts", 123).one("buildings", 456).one("spaces", 789).get() // POST /accounts/123/buildings/456/spaces Restangular.one("accounts", 123).one("buildings", 456).all("spaces").post({name: "New Space"});I hope this works for you :). You can check the tests for this functionality as well :)
Hi Gonto, I have another probably simple question, but I'm not finding an example in the Restangular docs. Let's say I have companies, and then people in the companies. I have a REST API that will take a GET of "/companies/1/people/123". If I have the IDs of the company and the person, what's the right way to do that GET from Restangular?I thought it would probably be something like this:var company = Restangular.one("companies", company_id);var person = company.one("people", person_id);return person.get();
//In your app configuration (config method) RestangularProvider.setOnElemRestangularized(function(elem, isCollection, route) { if (!isCollection && route === "buildings") { // This will add a method called evaluate that will do a get to path evaluate with NO default // query params and with some default header // signature is (name, operation, path, params, headers, elementToPost) elem.addRestangularMethod('evaluate', 'get', 'evaluate', undefined, {'myHeader': 'value'}); } return elem; }) // Then, later in your code you can do the following: //GET to /buildings/123/evaluate?myParam=param with headers myHeader: value //Signature for this "custom created" methods is (params, headers, elem) // If something is set to any of this variables, the default set in the method creation will be overrided // If nothing is set, then the defaults are sent building.evaluate({myParam: 'param'}); //GET to /buildings/123/evaluate?myParam=param with headers myHeader: specialHeaderCase building.evaluate({myParam: 'param'}, {'myHeader': 'specialHeaderCase'});
// myController: var User = Restangular.one('users', $routeParams.id); User.get().then(function(tmp){ $scope.User = tmp; }); $scope.save = function(){ $.extend(User, $scope.User); User.put(); };
any suggestions? Or is this the way ive to do it?
--
$scope.User = Restangular.one('users', $routeParams.id).get();
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
Hey,You're absolutely right.The TypeAhead library must be able to receive data async, as that's one of the main features of it. Check out AngularStrap, I've used it with Restangular and it works great :).
- <!-- Async function defined in your controller -->
- $scope.typeaheadFn = function(query, callback) {
- $http.get('/stations/autocomplete?term='+query).success(function(stations) {
- callback(stations); // This will automatically open the popup with retrieved results
- });
Bests,Gonto
On Saturday, April 13, 2013 2:55:42 AM UTC-3, Mason Jones wrote:Actually, never mind my follow-up question here; obviously it needs to be able to handle the delayed data, it's just not doing it properly right now...
On Friday, April 12, 2013 10:44:22 PM UTC-7, Mason Jones wrote:Thanks for your quick response. Yes, this does make sense, actually; I hadn't quite thought it through that even long after the data was loaded, in a separate click-driven event, it still needs to use then().Here's a follow-up question, as I'm working on using Restangular in an autocomplete function as well... I'm having the trouble that when the user types something, it's not expected to return without the data:$scope.doGetAutocomplete = function (request, response) {var allUsers = Restangular.all('users.json');allUsers.getList('', {query: $scope.ownerSearch}).then(function(data) {response(data.suggestions);});};This "works" except that the doGetAutocomplete() function returns immediately, which blows up. What's the best way to block the return until the then() function finishes?Thanks again, I appreciate the tips.