Spark Spark - 8 months ago 107
AngularJS Question

Working with Angular js, Node js server and express js

So, I have a welcome page with sign in button which loads a Modal form built on Angular Js. It works fine when I run the welcome.html page as a standalone page on Google Chrome.

Now, I've created a Express Js framework project and modified the .html to .ejs and added them to views and then started the node server which will load the welcome.ejs page perfectly.

But, When I click on Sign in button, it throws the following error in console.

angular.js:11756 GET http://localhost:3000/views/login-popup.ejs 404 (Not Found)

angular.js:11756 GET http://localhost:3000/views/login-popup.ejs 404 (Not Found)(anonymous function) @ angular.js:11756m @ angular.js:11517g @ angular.js:11227(anonymous function) @ angular.js:15961$eval @ angular.js:17229$digest @ angular.js:17045$apply @ angular.js:17337(anonymous function) @ angular.js:25023Qf @ angular.js:3456d @ angular.js:3444
angular.js:13550 Error: [$compile:tpload]$compile/tpload?p0=%2Fviews%2Flogin-popup.ejs&p1=404&p2=Not%20Found
at Error (native)
at n.$eval (
at n.$digest (
at n.$apply (
at l (
at H (
at XMLHttpRequest.u.onload (

This is how my Angular will load the Modal

app.controller('LoginController',['$scope','$uibModal', function($scope,$uibModal){
$ = 'a100';
$scope.loginModal = function(){
var modalInstance = ${
animation: 'true',
templateUrl: '/views/login-popup.ejs',
controller: 'LoginModalController'

Node Code:


var server = app.listen(3000);
console.log("Server Started at port 3000");

I'm all new to Node and Angular and also to Express framework. Can you please guide me here.

Thanks for your time.

P.S: I've tried removing the
as well.


It seems you haven't exposed your static files (css, js).

This article explains how to do this with express.

And here is the code to get started quickly (copy paste from article)


What this does is that the folder public will be exposed to the web.

Express looks up the files relative to the static directory, so the name of the static directory is not part of the URL.