JavaScript AngularJS - $http.get request gets cancelled angularjs http request,angularjs http request example,angularjs http request

I'm trying to get data from a server in my AngularJS app, using $http.get. But when I execute the request, it seems to get cancelled by something. It happens with every link I use. Local files are working.

Below the code from Controller.js:

angular
    .module('schoolApp')
    .controller('configController', [
        'apiService', '$http', function (apiService, $http) {

        var vm = this;

        vm.isActive = isActive;
        vm.addPortal = addPortal;

        ...

        function addPortal() {

             ...

             apiService.getServerData('someUrl', "1.0")
                .then(function (result) {
                    var test = result.data;
                })
                .catch(function (result) {
                    console.log(result);
                });

        }

        ...

And the Service.js:

angular
.module('schoolApp')
.service('apiService', [ '$http', function ($http) {
    var service = {
        getServerData: getServerData,
    };

    return service;

    function getServerData(portalUrl, appVersion) {
       // var url = "http://../.../.svc/GetSetting?alias=...&AppVersion=1.0";
        var url = "http://xml.buienradar.nl";
        //var url = "test.json";
        //var url = "xml.xml";
        // "http://" +
        // portalUrl +
        // "/.../.../.svc/GetSetting?alias=" +
        // portalUrl +
        // "&AppVersion=" +
        // appVersion;
        return $http.get(url);
    }
}]);

Executing this code will show the alert("ERROR: " + result) from the controller class. Data from the result:

result: Object
config: Object
data: null
headers: (c)
status: -1
statusText: ""
__proto __: Object

Network in browser shows the call is cancelled:

http://i.stack.imgur.com/MJoZM.png

More info: - I'm using Phonegap (tested without and doesn't work either) - AngularJS 1.4

Answer:1

So I can create a whole bunch of empty objects that are independent with my code below. Is there a better way to do this? Or is this the only method? var array = []; for (let i = 0; i < 5; ...

So I can create a whole bunch of empty objects that are independent with my code below. Is there a better way to do this? Or is this the only method? var array = []; for (let i = 0; i < 5; ...

Here is my setup. I have a grunt task that does 2 things: 1) start a http server listening on some port 2) triggers another grunt task The grunt task triggered above is a testem task that runs tests ...

Here is my setup. I have a grunt task that does 2 things: 1) start a http server listening on some port 2) triggers another grunt task The grunt task triggered above is a testem task that runs tests ...

  1. post call from browser
  2. post call from javascript
  3. post call from java
  4. post call from postman
  5. post call from angular
  6. post call from python
  7. post call from c#
  8. post call from react
  9. post call from jquery
  10. post call from php
  11. post call from curl
  12. post call from html
  13. post call from node js
  14. post call from js
  15. post call in react js
  16. post call from angular 7
  17. post call from ajax
  18. post call from react js
  19. post call from angularjs
  20. post call in angular 6

I'm doing an example for this javascript textbook and it's a simple calculator. There are two input (number) tags where the user selects a number and a select tag with options for a modifier (see code)...

I'm doing an example for this javascript textbook and it's a simple calculator. There are two input (number) tags where the user selects a number and a select tag with options for a modifier (see code)...

  1. value option select jquery
  2. value option select
  3. value option select html
  4. value option select javascript
  5. value option select php
  6. option value select all
  7. option value select default
  8. value select option angular
  9. option value select js
  10. value select option angularjs
  11. option value select tag
  12. option value select name
  13. option value select disabled
  14. option value select input
  15. set value option select jquery
  16. get value option select jquery
  17. change value option select jquery
  18. set value option select javascript
  19. get selected option value
  20. get value option select javascript

Please find my JSON below: I want to identify unique user and get the corresponding unique users value count. For Example: userID: user1 has 3 records and I want to form the JSON like below: ...

Please find my JSON below: I want to identify unique user and get the corresponding unique users value count. For Example: userID: user1 has 3 records and I want to form the JSON like below: ...

  1. identify duplicate values in excel
  2. identify duplicate values in r
  3. identify duplicate values in google sheets
  4. identify duplicate values in two columns
  5. identify duplicate values in sql
  6. identify duplicate values in pandas
  7. identify duplicate values in a column excel
  8. identify duplicate values in two columns excel
  9. identify duplicate values in excel formula
  10. identify duplicate values in multiple columns in excel