Johnathan Mackney Johnathan Mackney - 1 year ago 192
AngularJS Question

EJS.JS ReferenceError: title not defined

I am having an issue with a script in express. I am calling a function that renders a view, on the success of another function. In this project I am utilizing angular, node, express, and ejs as view engine. When I render the view, I unfortunately receive an ejs error of the following:

ReferenceError: /Users/emilywfrancis/Desktop/nodejs-angularjs-sequelizejs/views/about.ejs:5

3| <html ng-app="app">

4| <meta charset="utf-8">

5| <link rel="stylesheet" href="//" />

6| <% include header %>

7| <% include navbar %>

8| <body>
title is not defined

Here is the code:

exports.verifyusers= function(req, res) {
where: {
password: req.body.password
}).then(function(res, user) {
if(user == "") { //if user exists in database


Seems like the error is actually in the header file which proprely contains something like:

<%= title %>

I think changing changing it to the following will work:

<%= (typeof title != "undefined" ? title : "") %>