I have following code for ejs page, a script and a nodejs script. When I execute ejs page independently, it works fine, however the same page fails to load when rendered via nodejs. Please assist
ejs page:
'
<html>
<script src="/home/aniruddha/Downloads/angular.js"></script>
<script src="/home/aniruddha/NodeJS/script.js"></script>
<Title>AngularJS and NodeJS in action </Title>
<body ng-app="Main">
<div ng-controller="Display">
</div>
</body>
</html>
script:
var mod=angular.module("Main",[]);
var cntrolr=function($scope) { $scope.message="This is from AngularJS!!"; };
mod.controller("Display",cntrolr);
nodejs script:
var express=require('express');
var path=require('path');
var app=express();
//var ang=require('angular');
app.set('view engine','ejs');
app.set('views', path.join(__dirname,'views'));
app.get('/', function (req,res) { res.render('index');});
app.listen(8080,function(){ console.log('Listening on port 8080');}); '
When I load the page with above mentioned nodejs script, page returns with variable name but not the value
via Aniruddha
No comments:
Post a Comment