Skip to content

Commit 16bbde7

Browse files
author
Benjamin LONGEARET
committed
Refactor and add day 3 slides & guide
1 parent db09e95 commit 16bbde7

File tree

7 files changed

+104
-2
lines changed

7 files changed

+104
-2
lines changed

day_03/AngularJS-jour3-guide.pdf

137 KB
Binary file not shown.

day_03/AngularJS-jour3-slides.pdf

87.5 KB
Binary file not shown.

day_04/step_02/index_03_service.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
var app = angular.module('app', []);
77
app.service('userService', function($http) {
88
this.getUser = function () {
9-
return $http.get('users.json');
9+
return $http.get('/mock/users.json');
1010
};
1111
});
1212
app.controller('MyController', function (userService) {

day_04/step_02/index_04_factory.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
deferred.resolve(_privateUser);
1515
return deferred.promise;
1616
}
17-
return $http.get('users.json').then(function(res) {
17+
return $http.get('/mock/users.json').then(function(res) {
1818
_privateUser = res.data;
1919
return _privateUser;
2020
});

day_04/step_03/index.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<html>
2+
3+
<head>
4+
<script type="text/javascript" src="../../bower_components/angular/angular.js"></script>
5+
<script type="text/javascript">
6+
var app = angular.module('app', []);
7+
8+
app.service('userService', function($http) {
9+
this.getUser = function () {
10+
return $http.get('/mock/users.json');
11+
};
12+
this.getUserError = function () {
13+
return $http.get('usersss.json')
14+
};
15+
});
16+
17+
app.controller('MyController', function (userService) {
18+
var self = this;
19+
20+
this.getUserError = function () {
21+
userService
22+
.getUserError()
23+
.then(function(res) {
24+
self.users = res;
25+
}, function (err) {
26+
self.users = err;
27+
console.log('Bad Request!!!');
28+
});
29+
};
30+
31+
this.getUser = function () {
32+
userService
33+
.getUser()
34+
.then(function(res) {
35+
self.users = res;
36+
});
37+
}
38+
});
39+
40+
</script>
41+
</head>
42+
43+
<body ng-app="app" ng-controller="MyController as my">
44+
45+
<h4>$http usage</h4>
46+
<button type="button" ng-click="my.getUser()">SUCCESS</button> <button type="button" ng-click="my.getUserError()">ERROR</button>
47+
<pre>{{ my.users | json }}</pre>
48+
49+
</body>
50+
51+
</html>

day_04/step_04/index.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<html>
2+
3+
<head>
4+
<script type="text/javascript" src="../../bower_components/angular/angular.js"></script>
5+
<script type="text/javascript">
6+
var app = angular.module('app', []);
7+
8+
app.service('userService', function($http) {
9+
this.getUser = function () {
10+
return $http.get('/mock/users.json');
11+
};
12+
this.getUserError = function () {
13+
return $http.get('usersss.json')
14+
};
15+
});
16+
17+
app.controller('MyController', function (userService) {
18+
var self = this;
19+
20+
this.getUserError = function () {
21+
userService
22+
.getUserError()
23+
.then(function(res) {
24+
self.users = res;
25+
}, function (err) {
26+
self.users = err;
27+
console.log('Bad Request!!!');
28+
});
29+
};
30+
31+
this.getUser = function () {
32+
userService
33+
.getUser()
34+
.then(function(res) {
35+
self.users = res;
36+
});
37+
}
38+
});
39+
40+
</script>
41+
</head>
42+
43+
<body ng-app="app" ng-controller="MyController as my">
44+
45+
<h4>$http usage</h4>
46+
<button type="button" ng-click="my.getUser()">SUCCESS</button> <button type="button" ng-click="my.getUserError()">ERROR</button>
47+
<pre>{{ my.users | json }}</pre>
48+
49+
</body>
50+
51+
</html>
File renamed without changes.

0 commit comments

Comments
 (0)