All Questions
Tagged with angularjs-controller angularjs-http
20
questions
19
votes
2answers
12k views
How can we test non-scope angular controller methods?
We have few methods in Angular Controller, which are not on the scope variable.
Does anyone know, how we can execute or call those methods inside Jasmine tests?
Here is the main code.
var ...
13
votes
4answers
15k views
Getting AngularJS Error: “[$rootScope:inprog] $digest already in progress” without a manual $apply
Other posts on this error always include someone trying to $apply without using a safe apply, but that's not the case in my example. My function IS successfully returning the data I requested from the ...
6
votes
1answer
12k views
Angular JS TypeError: $http is not a function
I have read through all the posts where people get this issue where $http is not a function, and it looks like for the most part it is due to injections being done in the wrong order.
My module ...
6
votes
2answers
8k views
AngularJS : controller scope won't sync with promise
I've picked up a project and I'm trying to return some data from a service to my controller. I've been at this for about 12 hours, and have tried different methods. They all usually result in this ...
5
votes
1answer
38k views
TypeError: (intermediate value)(intermediate value).success is not a function (angular)
I have difficulties understanding this error... I dont quite understand why its not a function....
angular.module('mkApp').factory('mkService', function ($http, $log) {
function getLookUp(successcb)...
4
votes
4answers
835 views
AngularJS $http use response in multiple controllers
I have an app where I am loading a bunch of albums in one partial and then when a user clicks on each individual album, they get details for the album like songs, etc. Right now I am pulling the data ...
4
votes
1answer
3k views
How do you check if the data is null in http.get in angularjs AND do something?
My code:
<script>
function customersController($scope, $http) {
$http.get("https://tic.com/testingservice/HttpService.svc/operator/Var1/Var2")
.success(function (response) { ...
3
votes
2answers
7k views
AngularJS: assign $http.get data to variable
I try to assign data from $http.get to variable in my controller.
$http.get(URL).success(function (data) {
$scope.results = data;
console.log('results in $http.get :'+ $scope.results);
...
3
votes
1answer
4k views
AngularJS access variable inside $http.get
app.controller('EntryCtrl', ['$scope', '$http', function($scope, $http){
$http.get(something.json).success(function(data){
$scope.entries = data;
});
abc = $scope.entries.timestamp; ...
1
vote
2answers
1k views
Slim Post method not working with AngularJs Http Request
This is my AngularJS controller :
app.controller('emailConfirmCtrl', function ($scope, $http) {
$scope.check_credentials = function () {
var request = $http({
method: 'POST',
url: '...
0
votes
1answer
3k views
Storing HTTP Response as a Controller Variable
I'm wondering if there's a way to take an $http response and store it to a controller variable as opposed to the $scope. For example:
app.controller('testController', function($scope, $http) {
...
0
votes
1answer
628 views
Rest Webservice call in AngularJS ( promise )
AngularJS : 1.4.X
Scenario 1: Works fine
Scenario 2: Throws 404 error on line xhr.send(isUndefined(post) ? null : post); in angular.js
I'm trying to add inbuilt angular cache to our existing app, ...
0
votes
1answer
104 views
How to pass $http data from Service to Controller in AngularJS
AngularJS not working when I pass controller to the view
I have a problem and I can't troubleshoot it. In my simple app (very simple) I have a service that provides of users info. In angular I have ...
0
votes
2answers
79 views
Compare 2 GET object from different controllers
I have 2 (array of) objects from 2 different controllers.
Object 1 (Name Controller 1):
[{id:1,"name":"jakov"},...]
Object 2 (Nickname Controller 2 ):
[{id:1, "nickname" : "jandric", "nameId" :1, "...
0
votes
1answer
338 views
How to get different controllers to use different configurations of $httpProvider in AngularJS?
I have a AngularJS project using the directory layout from angular-seed.
https://github.com/angular/angular-seed
app.js contains the configuration of my http provider. All my controllers have to use ...
0
votes
1answer
79 views
Retrieving data out of post success from separate controller angularjs
I am writing a simple service that uploads a file and posts it to a Spring controller. The controller manipulates this data and returns several objects as JSON.
I am working with the following Angular ...
0
votes
1answer
479 views
$http service in Factory returns undefined in AngularJS
I am new in angularJS and try to make a CRUD operation to clear my concept. I try to use angular factory but I google a lot and unable to find any solution on below concept. I just want to use my ...
0
votes
2answers
320 views
$http.get is undefined when $http is used outside angular code
I am running jasmine unit test against a method which is outside angular controller.
Running the jasmine throws the following error,
TypeError: Cannot read property 'get' of undefined at ...
0
votes
1answer
2k views
How to $http.post with payload in data?
How do I post data from a form in AngularJS?
<form data-ng-submit="doSomething()">
<input type="text" data-ng-input="do_obj.text"/>
<input type="email" data-ng-input="do_obj....
0
votes
2answers
43 views
AngularJS - Factory from Controller - not getting value from $http.get
I have a newbie question here.
I am coding a factory in angularJS. With it I want to have a list of users, and also a method to fill it.
So this is my code ...
The factory
app.factory("...