Skip to content

Commit b5b9b7c

Browse files
committed
MEAN news sample with images
1 parent 14b3e0e commit b5b9b7c

File tree

9 files changed

+209
-110
lines changed

9 files changed

+209
-110
lines changed

csv-mean/README.md

Whitespace-only changes.

mean-news/README.md

+68-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,71 @@ npm install
88

99
```
1010
npm start
11-
```
11+
```
12+
13+
14+
Angular Controler configuration:
15+
16+
```JS
17+
var app = angular.module('notesNews', ['ui.router']);
18+
app.config([
19+
'$stateProvider',
20+
'$urlRouterProvider',
21+
function ($stateProvider, $urlRouterProvider) {
22+
23+
$stateProvider
24+
.state('login', {
25+
url: '/login',
26+
templateUrl: '/login.html',
27+
controller: 'AuthCtrl',
28+
onEnter: ['$state', 'auth', function($state, auth){
29+
if(auth.isLoggedIn()){
30+
$state.go('home');
31+
}
32+
}]
33+
})
34+
.state('register', {
35+
url: '/register',
36+
templateUrl: '/register.html',
37+
controller: 'AuthCtrl',
38+
onEnter: ['$state', 'auth', function($state, auth){
39+
if(auth.isLoggedIn()){
40+
$state.go('home');
41+
}
42+
}]
43+
})
44+
.state('posts', {
45+
url: '/posts/{id}',
46+
templateUrl: '/posts.html',
47+
controller: 'PostsCtrl',
48+
resolve: {
49+
post: ['$stateParams', 'posts', function($stateParams, posts) {
50+
return posts.get($stateParams.id);
51+
}]
52+
}
53+
})
54+
.state('home', {
55+
url: '/home',
56+
templateUrl: '/home.html',
57+
controller: 'MainCtrl',
58+
resolve: {
59+
postPromise: ['posts', function (posts) {
60+
return posts.getAll();
61+
}]
62+
}
63+
});
64+
65+
$urlRouterProvider.otherwise('home');
66+
}
67+
]);
68+
```
69+
![Screenshot](images/sample1.png)
70+
71+
![Screenshot](images/sample2.png)
72+
73+
74+
![Screenshot](images/sample3.png)
75+
76+
77+
![Screenshot](images/sample4.png)
78+

mean-news/images/sample1.png

88.4 KB
Loading

mean-news/images/sample2.png

30.6 KB
Loading

mean-news/images/sample3.png

36.2 KB
Loading

mean-news/images/sample4.png

28.9 KB
Loading

0 commit comments

Comments
 (0)