Here is my code. I am trying to call the header in the routes and controller and it will not work correctly. Please let me know if anyone knows why this is happening. Routes.js:
module.exports = function(app) {
var http = require("http");
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
});
app.get('/forumDetailsHeader', function(req, res) {
// res.setHeader('Content-Type', 'Forum Details Header');
res.send(JSON.stringify({
"header": "Forum Details Header"
}));
});
};
forumDetailsCtrl.js:
var app = angular.module('huddleBoard');
app.controller('forumDetailsCtrl', ['$scope', '$http',
function($scope, $http) {
$scope.header = "";
// $scope.header = "Forum Details Header";
$http.get('/forumDetailsHeader').then(function(value) {
$http.header = value.header;
console.log('Hello World');
// res.header('Forum Details Header', 0);
});
$scope.lines = [{
text: 'Name:'
}, {
text: 'Schedule:'
}, {
text: 'Leader:'
}, {
text: 'Facilitator:'
}, {
text: 'Dial-in Number:'
}, {
text: 'Objective:'
}];
}
]);
UPDATE: So, I think there is something that has to deal with the controller side not correctly configuring the $http.get function. If anyone has knowledge of this please help me out. Also, I didn't know if there was something also that has to deal with my html file. When I display the webpage, it is showing {{header}} which is what is called in my html, the following is the html side of all of this, I am just wondering if that needs to be changed as well
<div data-ng-contrller="forumDetailsCtrl">
<h3 data-ng-model="header">{{header}}</h3>
<div ng-repeat="line in lines">
<div class = "preview">{{line.text}}</div>
</div>
</div>