I am using angular fullstack generator for creating a web application. I want to send a file data from nodejs server to display in the Front end.But data is sent in unformatted manner since i am receiving it in a variable( as a array of strings). Plz. tell me how to get the file data as it is (in the file at server )in the front end.
My nodejs code :
function readstack() {
fs = require('fs')
fs.readFile('outstack.txt', 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
console.log(data);
res.send(data);
});
}
var stackend = setTimeout(readstack,30000);
My angular controller code :
$http.get('/runtrace').success(function(response){
console.log("requested data");
$scope.output= response;
I am displaying in front end by :
<div id="divoutput">
{{output}}
</div >