I'm just testing the waters by pushing an AngularJS build onto Heroku but it's not displaying what I want in the double curly brackets. Not sure what the issue is, as my srcs seem to be correct. This is my index.ejs file:
<!DOCTYPE html> <html ng-app="rantList" > <head> <!--<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"> </script> <!--<link rel = "stylesheet" type = "text/css" href = "/node_modules/bootstrap/dist/css/bootstrap.min.css"/>--> </head> <body > </div> <div ng-controller = "RantController as rantList" > <h1> {{rantList.piece.name}}</h1> <p> {{rantList.piece.paragraph}} </p> </div> <!-- <script type = "text/javascript" src = "/node_modules/angular/angular.min.js"></script>--> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> <script type = "text/javascript" src = "/../app.js"> </script> <!--<script src = "https://code.angularjs.org/1.4.3/angular-route.js"> </script>--> <p>{{"Hello"}}</p> </body> </html> This is my app.js file:
(function(){ var app = angular.module('rantList', []); app.controller('RantController', function(){ this.piece = rant; }); var rant = { name: 'First User', paragraph: '....', } })(); And this is my server.js file:
var express = require('express'); var app = express(); // set the port of our application // process.env.PORT lets the port be set by Heroku var port = process.env.PORT || 8080; // set the view engine to ejs app.set('view engine', 'ejs'); // make express look in the public directory for assets (css/js/img) app.use(express.static(__dirname + '/public')); // set the home page route app.get('/', function(req, res) { // ejs render automatically looks in the views folder res.render('index'); }); app.listen(port, function() { console.log('Our app is running on http://localhost:' + port); }); In the double curly brackets, it displays rantList.piece.name rather than First User (first example), and in the second example it displays {{"Hello World"}} rather than Hello World. Thanks for your time, I'm rather new with this and would appreciate any help.