Questions tagged [ngresource]

The AngularJS ngResource module provides interaction support with RESTful services via the $resource service.

Resources

Tags

525 questions
2
votes
1 answer

Using params in ngResource post URL

I'm working with a FosRestBundle API, and I must pass params in an url post resource to perform an operation. The post resource in FosrestBundle is something like this : api/readQuestion/{contain_id}/{user_id}/{type_id}/Questions So to to send data…
kabrice
  • 1,475
  • 6
  • 27
  • 51
2
votes
1 answer

Waiting until $resource finished to load in my controller before continuing

I'm building a rest api with fosrestbundle and I manage the frontend with angular and Twig template. One on my url address looks like this : http://mywebsite/myroute/idContain When I load the url in my browser, in a twig template (kind of html), I…
kabrice
  • 1,475
  • 6
  • 27
  • 51
2
votes
0 answers

How to pass in API subdomain to ngResource?

I'm using ngResource to consume a RESTful API, and have implemented the following service: app.factory('User', function($resource) { return $resource('/api/users/:id', { id: '@id' }); }); I would like to pass in a subdomain to it. Is there a way…
rebagliatte
  • 2,110
  • 1
  • 20
  • 25
2
votes
1 answer

ngResource doesn't work when parse HTML from JSON file

I am trying to get blog posts from json file and parse 'description' in HTML format. I use ngResource, but I don't get anything This is sample data from json jsonFeed({ "title": "My Blog", "description": "", "modified":…
2
votes
0 answers

Send json object as url parameter

I'm creating an Angular app using ngResource, and i want to send a search/filter/pagination (I am using sequelize as ORM in the backend, and i want to use that object to apply the search, filter and pagination stuf directly) parameter to a GET…
2
votes
1 answer

Opening a pdf with angular ngResource from an MVC post request

I have a POST request for a PDF document in an APIController, here's the code: Generator pdfGenerator = new Generator(); MemoryStream ms = pdfGenerator.Generate(); var response = new HttpResponseMessage { StatusCode =…
Ana Franco
  • 1,611
  • 3
  • 24
  • 43
2
votes
0 answers

retrieving single and multiple objects from JSON using ngResource

I am learning AngularJS through the book "Learning Web Development with Bootstrap and Angularjs” by Stephen Radford. There is a single “Contacts Manager” project which is developed in it throughout the chapters with the help of angularJS and a bit…
Abbadiah
  • 171
  • 1
  • 3
  • 10
2
votes
1 answer

AngularJS - XX is not a function

In AngularJS I have Controller as follows: function LoginController($scope, $rootScope, $location, $cookieStore, UserService) { $scope.rememberMe = false; $scope.login = function() { UserService.authenticate($.param({ …
Araneo
  • 477
  • 2
  • 9
  • 25
2
votes
1 answer

Remove 'Content-Type' header in ngResource angular

I am new to angular . In my application, i want to upload a file to the server . according to the api , 'Content-Type' header should be null or not sent. I googled and developers proposed to set the header as undefined . The below is my code…
2
votes
2 answers

ngResource: Custom update method cleans the instance

I make this Customer service with $resource: .factory('Customer', function($resource, apiURL){ return $resource(apiURL+'customers/:id', { id: '@id' }, { 'update': {method: 'PUT'} }) }) When I update the customer (that is a Instance…
Marcos Kubis
  • 485
  • 1
  • 4
  • 11
2
votes
1 answer

clear cache of angular $resource

In my use case I have Carts and LineItems. My REST service has the following resource urls: get|post|delete|put api/v1/carts/:cartId get|post|delete|put api/v1/carts/:cartId/lineItems/:lineItemId get|post|delete|put…
dimitar
  • 63
  • 5
2
votes
1 answer

Ngresource specify different URL's get all and get one

I have a RESTFUL API whose GET URL's are For all : /customers.json For single: /customers/1.json angular.module('myApp.services', []).factory('Customer', function($resource) { return $resource('api/v1/customers/:id.json', { id:'@customers.id' },…
LeoG
  • 683
  • 1
  • 8
  • 22
2
votes
1 answer

How to set default header values in Angular Resource?

The following approach does not work: angular.module('myApp.myModule').factory('MyResource', function($resource, $cookies) { var token = $cookies.get('token'); var user = $cookies.get('username'); console.log ("Token: "+token+" User:…
2
votes
2 answers

AngularJS using ng-resource with multiple server polling methods

I am using the method based on this answer: Server polling with AngularJS But how can I set this update when I have multiple polling methods? Here is a snippet of my service: function pollingService($resource) { return { methodA:…
stibay
  • 1,200
  • 6
  • 23
  • 44
2
votes
2 answers

Handling errors on 200 HTTP response using interceptors

I have service that integrates with external API. This API is inconsistent and it is unlikely to change. Inside API there are 2 methods of reporting error, one is response with HTTP 500 code, other is normal 200 HTTP reponse, but with status in JSON…
GwynBleidD
  • 20,081
  • 5
  • 46
  • 77