Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ahmed Saleh
    @AhmedZaleh
    ah yes, they are on different ports
    however, i'm setting the CORS headers on my server side api
    Ahmed Saleh
    @AhmedZaleh
    it was all about CORS policy, i used https://github.com/cyu/rack-cors to solve the problem
    Heitor Neiva
    @hneiva
    I can't upgrade from 1.2.1 because some of the API's I access return non-list responses on getList anyway I can disable this check on restangular configuration?
    Andrea Passaglia
    @gurghet
    Nice geometric form
    Andrew Boehner
    @Boehner
    "dependencies": {
        "lodash": ">=1.3.0",
        "angular": "~1.x"
      },
    Should this look for lodash breaking changes ? Had an issue today when lodash upgraded to 4.0.0
    This message was deleted
    Andrew Boehner
    @Boehner
    #1295 found the open issue
    Mathew Foscarini
    @thinkingmedia
    It's contains a reserved word now? Maybe it's in Object
    Heitor Neiva
    @hneiva
    @mgonto Are you planning on updating this project?
    vinaykumar12
    @vinaykumar12
    how to post object in body while saving data
    how to send object to server without queryparams
    Matt Shwery
    @mshwery

    I'm having trouble finding good documentation on how to create a restangular service for a singular nested resource? One that does not accept an id in the path.

    Example:

    /users/:user_id/trends

    There is no :trends_id, but the endpoint is not a collection. It returns a single json object as opposed to an array of json objects.

    trends may not be the best example, but the point is that the resource is a has_one relationship to the parent.
    Matt Shwery
    @mshwery
    @mgonto any recommendation on this ^
    Cesar Bretana Glez
    @bretanac93
    Hello everyone, I spend the last hour looking for some resources that help me work with restangular combined with some other stuffs, I'm newbie on this, so I need a thing or two
    anggiaj
    @anggiaj
    Hey
    Matt Shwery
    @mshwery
    @bretanac93 anything in particular you were looking for? could you elaborate on "I need a thing or two"?
    Daniel Spasojevic
    @dspasojevic
    Hi, is there a way to replay a request from an error handler that will use the full interceptor stack for any replies?
    chanzian
    @chanzian
    hi, guys may i ask is printing(print out data as voucher) possible in ng-admin? anyone can help answer?
    Fredrik Boström
    @bostrom
    Hi all! Just wondering if anyone knows whether this project is being maintained anymore? Seems to be quite a few PRs open (including one of mine), but no-one seems to consider merging them.
    Matt Erman
    @CodeLiftSleep
    Quick question...I was trying to set up Restangular to return all JSON data from this site: https://jsonplaceholder.typicode.com/posts but I couldn't get it working with Restangular.all---I tried many different configurations, using $object after the get() and without it, etc, but it kept returning empty. If I attempted to return data using Restangular.one('posts',52).get(); it worked fine and returned that piece of data. Could anyone let me know what I was doing wrong and how to get this to work?
    Fredrik Boström
    @bostrom

    @CodeLiftSleep try

    Restangular.all('posts').getList().then(function (response) {
        console.log(response);
    });

    Example here: http://codepen.io/anon/pen/wzLYoo?editors=1010

    Matt Erman
    @CodeLiftSleep
    I am using a global function to make a restangular call and return the data, but keep getting undefined...I am doing it this way so I can have error checking built in and not have to do it with every call...this call works fine: Restangular.one('Contract/Get').get().then(function (response) { $scope.gridOptions.data = response; })
    but when I do this: APICalls.Get($scope.gridOptions.data, "Contract/Get", "There was an error retrieving the contracts!") where args are (model, route, errorMsg), $scope.gridOptions.data is undefined. I believe it has to do with setting a deferred promise because its an Async operation, but when I set the promise, resolve it and then return it, it doesn't come back as undefined, but it doesn't come back as anything and the code never seems to run APICalls.Get($scope.gridOptions.data, "Contract/Get", "There was an error retrieving the contracts!").then(function (response) { $scope.gridOptions.data = response;}) any help here?
    Matt Erman
    @CodeLiftSleep
                  this.GetTest = function (model, route, errorMsg) {
                            var deferred = $q.defer();
                            Restangular.one(route).get().then(function (response) {
                                model = response;
                                deferred.resolve();
                            }), function (e) {
                                alertify.error("There was an error retrieving the contracts!"); //Message passed in when it errors
                                console.log('Error!! ' + e.name + ':  ' + e.message); //console logs name of error and message
                                deferred.reject();
                            };
                            deferred.promise;
                        };
    why is this not waiting for deferred to return?? It never runs the .then(function (response)) until after the code in the main program continues
    I'm calling this from a service
    Fredrik Boström
    @bostrom
    Restangular's async methods return promises themselves, so there's no need to create your own deferred objects. Just return whatever Restangular returns. Your code modified:
    this.GetTest = function(model, route, errorMsg) {
      // restangular returns a promise, pass that on directly
      return Restangular.one(route).get().then(function(response) {
        model = response;
        return response; // if you want to pass the response on to whoever called GetTest
      }),
      function(e) {
        alertify.error("There was an error retrieving the contracts!"); //Message passed in when it errors
        console.log('Error!! ' + e.name + ':  ' + e.message); //console logs name of error and message
      };
    };
    Matt Erman
    @CodeLiftSleep
    Thanks! I see what is going on now, but it was confusing at first...
    Matt Erman
    @CodeLiftSleep
    Is there any reason why on a Delete or Update Restangular would be adding in extra URL parts?
    For instance I have several forms, on most of them Update and Delete work for me when I restangularizeElement and pass in "Contract/Update?id=" for the route but on one of them it ends up "Contract/Contract/Update?id=" so I just pass in "Update?id=" and it works fine, but on one of the Delete's its now attempting to go to ...."API/API/Contract/Delete?id=" instead of "API/Contract/Delete?id="...the part that is weird is I am not passing in the extra API from anywhere, and the only other place a URL is set is in the main setBaseUrl when angular loads...where is this extra API coming from??
    Fredrik Boström
    @bostrom
    @CodeLiftSleep can you show some real code to debug?
    Matt Erman
    @CodeLiftSleep
    @bostrom I endde up getting it sorted out...it was a dumb mistake on my part
    Fredrik Boström
    @bostrom

    @CodeLiftSleep it would be much easier to help you if we could see some real code of what you're actually doing.

    Restangular works well with API calls like GET /books, PUT /books/15, DELETE /authors/50/books/5 and so on. If you have some more exotic backend API, then you most probably have to either do custom requests in Restangular (customGET, customPOST etc), or use vanilla $http service in angular.

    Please put up a code example on jsfiddle or codepen or github etc so we can understand what you're trying to accomplish.

    Matt Erman
    @CodeLiftSleep
    is the associated call being made in APICalls
    Fredrik Boström
    @bostrom
    Where's Restangular in this?
    Matt Erman
    @CodeLiftSleep
    once the page redirects after you successfully finish the update, the route then becomes "Module/Module/Update?id=" if you try and update anything else
    Lol...ack! just realized I'm not using it for this, OMG I feel like an idiot
    hahahaha
    Ok, back to the issue at hand...do you know of a way to resolve that?
    Fredrik Boström
    @bostrom

    @CodeLiftSleep I don't think this is the proper forum for random JS questions, you should probably try StackOverflow or similar instead.

    However, I created a pen of your code and it runs ok, so your problem must be elsewhere. http://codepen.io/anon/pen/jVNyJX?editors=0011#0

    Matt Erman
    @CodeLiftSleep
    I think I fixed it..."../Module/Update?id=" seems to work right
    but its weird because the same thing doesn't work with delete, nor does delete have the same issue
    although it isn't redirecting you so I guess maybe that is why
    Fredrik Boström
    @bostrom
    You probably shouldn't be using window.location.href directly either. Try using ng-router or ui-router.
    Matt Erman
    @CodeLiftSleep
    we aren't using Angular routes currently, we are kind of retrofitting Angular with ASP.net/MVC
    That is probably going to switch over but it hasn't happened yet
    Matt Erman
    @CodeLiftSleep
    Ok, now this is a restangular question...how would I access A relative path as a get? Like in Razor I could do $http.get('@Url.Content("~/Utility/GetAllProviders")' to call a relative path to a function that will retrieve data
    archas
    @archasek
    hello guys!