restangular

Changes in eventSources model do not reflect in fullCalendar

亡梦爱人 提交于 2019-12-11 23:47:53
问题 Im using angularjs, restangular & angular-ui/ui-calendar. I want to load events from rest API when view is changed (next/prev month, etc.) I'm trying to do that from viewRender callback. Inside callback, data is retrieved from API and applied to eventSources model. However changes in model do not get applied in calendar. Someone please point out what is wrong or if I'm missing anything. I've tried fullCalendar('render') , rerenderEvents , refetchEvents etc. The calendar keeps showing initial

ngx-restangular installed in node_modules folder - 404 when importing from Angular service

巧了我就是萌 提交于 2019-12-11 14:08:56
问题 I'm upgrading an AngularJS solution to Angular 4 and I need to upgrade the 'restangular' library to use ngx-restangular instead, because I have an existing AngularJS service that uses restangular, and I need to convert it to Angular 4. I've installed ngx-restangular using: npm install --save ngx-restangular@1.0.13 This is the correct way to install ngx-restangular for Angular 4 (see https://www.npmjs.com/package/ngx-restangular#how-do-i-add-this-to-my-project-in-angular-4) I now have ngx

Restangular - PUT request payload is being sent as query string parameters

亡梦爱人 提交于 2019-12-11 11:59:19
问题 I'm using rectangular and have something like this: stuffResource = parentResource .one(resources.category, $scope.stuff.category) .one(resources.stuff, $scope.stuff.id) .put($scope.stuff); Now, when the request is sent, my "stuff" object is being sent in the query string instead of the body! What I'm I doing wrong here? 回答1: What you want to do here is use customPUT() instead of the normal put(). stuffResource = parentResource .one(resources.category, $scope.stuff.category) .one(resources

Restangular: How to read cookie and add to Headers at each query

只谈情不闲聊 提交于 2019-12-11 09:28:57
问题 I'm trying to read a token from a cookie and ad it to the headers at each query. I tried this: Restangular.setDefaultHeaders({ Authorization: "Token " + $cookieStore.get('token') }) It works, but the cookie only gets read once. At page load. Then if the value of the cookie changes, it keeps the first value instead of sending the updated value. Any idea how I can read the cookie each time? 回答1: You are passing a string, which is evaluated at the time the code is executed. It will never change

Webpack bundling causes Unknown provider $injector/unpr error

故事扮演 提交于 2019-12-11 04:49:45
问题 Unknown provider - NavigationCtrl, Restangular I'm currently working through my old projects to get them fully working again as a small refactoring exercise and I came across some AngularJS code that doesn't compile anymore. I believe this is down to the updated dependencies as I have not changed the functionality of this source code for at least 3 years. The issue I'm getting is: angular.js:15567 Error: [$injector:unpr] Unknown provider: AProvider <- A <- NavigationCtrl https://errors

Restangular getList() returning empty array

梦想的初衷 提交于 2019-12-11 04:38:47
问题 I am trying to invoke a Java REST API from Angular JS using Restangular. I am able to see proper response in the network tab but the response object is having empty array while i try to log the same in console or display in the html file. class TestClass { /*@ngInject*/ constructor($log, Restangular) { this.Restangular = Restangular; this.$log = $log; this.test = "somethings"; var me = this; this.Restangular.all('api/people/').getList().then(response => { this.test = response; console.log

How do I get an ID that is part of a URL, in angularjs? I am using Restangular to communicate with REST API's

前提是你 提交于 2019-12-11 03:52:39
问题 I am using Restangular to make backend calls and everything works fine as long as URL gives me data like below: If I hit http://mysite/responses/ the responses look like [ {"fname":"some guy", "lname":"some name", "dob":2091, "job":"mgr", "id":"100" }, {"fname":"another guy", "lname":"anpther name", "dob":1991, "job":"worker", "id":"101" }, {"fname":"someone", "lname":"some name", "dob":1997, "job":"dev", "id":"102" }, {"fname":"some guy2", "lname":"some name", "dob":2091, "job":"sec", "id":

Download a file from REST API with Restangular request

别来无恙 提交于 2019-12-11 03:32:15
问题 I've got a simple node.js + Restify backend with standard CORS settings and this endpoint: var file = '1,5,8,11,12,13,176,567,9483'; server.get('/download', function(req, res, next) { res.set({"Content-Disposition": "attachment; filename='numbers.csv'"}); res.setHeader("Content-type", "text/csv"); res.send(file); return next(); }, function(err) { res.send(err); }); What it's suppose to do is to is to create CSV file and return it. It works great when I simply type in the endpoint address to

AngularJS: multiple promises resolving erratically

牧云@^-^@ 提交于 2019-12-11 03:25:38
问题 I am assigning two collections into my scope in a controller; both come from services wrapping RestAngular and return promises. Each individually returns the collection I want, but when I assign both to $scope one of them never resolves (it's the same one that fails, no matter the order they're in). If I log to console by calling the offending service again, then lo and behold the original assignment works perfectly. The services both work pretty much the same: .factory('Role', ['Restangular'

AngularJS - Consuming REST API with Restangular in a factory

我们两清 提交于 2019-12-11 00:55:11
问题 I understand how to use Restangular in a controller, however my thoughts are that Restangular is essentially an ORM on steroids. The ORM shouldn't have any knowledge of the state of the application. That is the job of the controller. I also want to re-use queries to the ORM, and as such, I believe that Restangular should be used inside a service. My problem is that I am a js / angularjs and restangular noob, having only about 2-3 months exp with anything front-end. My Controllers: app