-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyController.js
55 lines (47 loc) · 1.68 KB
/
myController.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
50
51
52
53
54
55
(function () {
'use strict';
angular
.module('app')
.controller('myController', function ($scope,$http,myFactory) {
$scope.working = '';
$scope.users = [];
$scope.getData = function (url) {
return $http.get(url).then(
function success(response) {
$scope.worked = "Working"
},
function failure(reason) {
$scope.worked = "Not working"
}
);
}
$scope.getFromFactory = function (url) {
myFactory.getData(url).then(
function success() {
$scope.worked = "Working"
}, function failure() {
$scope.worked = "Not working"
})
}
$scope.getFromFactoryGOOD = function (url) {
myFactory.getDataGOOD(url).then(
function success() {
$scope.worked = "Working"
}, function failure() {
console.log("here");
$scope.worked = "Not working"
})
}
function initialize() {
var _url = "/common/timeZoneData.json";
return $http({
method: 'GET',
url: _url
}).then(function successCallback(response) {
console.log("data loaded");
}).catch(function () {
console.log("Data not loaded");
})
}
})
})();