@@ -5,22 +5,22 @@ angular.module('articles').controller('ArticlesController', ['$scope', '$statePa
5
5
$scope . authentication = Authentication ;
6
6
7
7
$scope . create = function ( isValid ) {
8
- if ( isValid ) {
9
- var article = new Articles ( {
10
- title : this . title ,
11
- content : this . content
12
- } ) ;
13
- article . $save ( function ( response ) {
14
- $location . path ( 'articles/' + response . _id ) ;
15
- } , function ( errorResponse ) {
16
- $scope . error = errorResponse . data . message ;
17
- } ) ;
18
-
19
- this . title = '' ;
20
- this . content = '' ;
21
- } else {
22
- $scope . submitted = true ;
23
- }
8
+ if ( isValid ) {
9
+ var article = new Articles ( {
10
+ title : this . title ,
11
+ content : this . content
12
+ } ) ;
13
+ article . $save ( function ( response ) {
14
+ $location . path ( 'articles/' + response . _id ) ;
15
+ } , function ( errorResponse ) {
16
+ $scope . error = errorResponse . data . message ;
17
+ } ) ;
18
+
19
+ this . title = '' ;
20
+ this . content = '' ;
21
+ } else {
22
+ $scope . submitted = true ;
23
+ }
24
24
} ;
25
25
26
26
$scope . remove = function ( article ) {
@@ -40,17 +40,17 @@ angular.module('articles').controller('ArticlesController', ['$scope', '$statePa
40
40
} ;
41
41
42
42
$scope . update = function ( isValid ) {
43
- if ( isValid ) {
44
- var article = $scope . article ;
43
+ if ( isValid ) {
44
+ var article = $scope . article ;
45
45
46
- article . $update ( function ( ) {
47
- $location . path ( 'articles/' + article . _id ) ;
48
- } , function ( errorResponse ) {
49
- $scope . error = errorResponse . data . message ;
50
- } ) ;
51
- } else {
52
- $ scope. submitted = true ;
53
- }
46
+ article . $update ( function ( ) {
47
+ $location . path ( 'articles/' + article . _id ) ;
48
+ } , function ( errorResponse ) {
49
+ $scope . error = errorResponse . data . message ;
50
+ } ) ;
51
+ } else {
52
+ scope . submitted = true ;
53
+ }
54
54
} ;
55
55
56
56
$scope . find = function ( ) {
0 commit comments