-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
49 lines (37 loc) · 1.3 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(function () {
"use strict";
var app = angular.module("app", ["ngActivityIndicator"]);
app.controller("AppController", function ($scope, WeatherService) {
$scope.weatherList = [];
$scope.refresh = function () {
WeatherService.create().then(function (data) {
$scope.weatherList = data.WeatherDescription;
});
};
$scope.refresh();
});
app.factory("WeatherService", function ($q, $activityIndicator) {
function create() {
var deferred = $q.defer();
$activityIndicator.startAnimating();
$.soap({
url: 'http://wsf.cdyne.com/WeatherWS/Weather.asmx/',
namespaceQualifier: "weat",
method: 'GetWeatherInformation',
namespaceURL: "http://ws.cdyne.com/WeatherWS/",
data: {}
}).done(function (result) {
var data = $.xml2json(result);
deferred.resolve(data);
$activityIndicator.stopAnimating();
}).fail(function (results) {
deferred.reject(results);
$activityIndicator.stopAnimating();
});
return deferred.promise;
}
return {
create: create
}
})
}());