June 2015
Intermediate to advanced
192 pages
4h 8m
English
The $http() method returns a promise, which is your way of determining what's happening with the request. It defines methods to which you can pass JavaScript functions that operate as event handlers when the underlying network transaction changes state.
The returned promise defines success and error methods, which take event handlers. To use them, we write the following code:
var app = angular.module("aprsapp", []); app.controller("AprsController", ["$scope", "$http", function($scope, $http) { $scope.json = ""; $scope.message = "Loaded..."; $scope.doAjax = function() { $scope.debug = "Fetching..."; $scope.json= ""; $scope.message = ""; var request = { call: "kf6gpe-7" }; var promise ...Read now
Unlock full access