-
Notifications
You must be signed in to change notification settings - Fork 5
/
cr_main.js
63 lines (38 loc) · 1.41 KB
/
cr_main.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
56
57
58
59
60
61
62
var app = angular.module("crow", []);
//load the navigation bar and set titles
app.controller('navigationCtrl', function($scope, $http) {
var setBasicInfo = function (response) {
var data = response.data
$scope.blog_name = data.blog_name;
$scope.blog_description = data.blog_description;
}
$http.get("cr_info.json").then(setBasicInfo);
});
//controller to set the navigation links
app.controller('linkCtrl', function ($scope, $http) {
var setLinkInfo = function($response) {
$scope.navigationLinks = $response.data;
}
$http.get("cr_menu.json").then(setLinkInfo);
});
//controller to display the posts
app.controller('blogCtrl', function($scope, $http) {
var displayPosts = function($response) {
$scope.posts = $response.data;
$scope.limit = 500;
$scope.read_more = "Read More";
$scope.open = false;
}
$http.get("cr_posts.json").then(displayPosts);
});
app.filter('trustAsHtml',['$sce', function($sce) {
return function(text) {
return $sce.trustAsHtml(text);
};
}]);
app.controller('sideBarCtrl', function ($scope, $http) {
var displaySideBarItems = function (response) {
$scope.sideBarItems = response.data;
}
$http.get("cr_sidebar.json").then(displaySideBarItems);
});