Working with Angular js, Node js server and express js
NickName:Spark Ask DateTime:2016-06-01T14:07:04

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] http://errors.angularjs.org/1.5.5/$compile/tpload?p0=%2Fviews%2Flogin-popup.ejs&p1=404&p2=Not%20Found
    at Error (native)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:6:412
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:156:158
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:130:226
    at n.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:144:467)
    at n.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:142:47)
    at n.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:145:249)
    at l (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:97:55)
    at H (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:101:190)
    at XMLHttpRequest.u.onload (https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js:102:229)

This is how my Angular will load the Modal

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

Node Code:

app.get('/',function(res,req){
    res.render('welcome');
});

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 /views as well.

Copyright Notice:Content Author:「Spark」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37560656/working-with-angular-js-node-js-server-and-express-js

More about “Working with Angular js, Node js server and express js” related questions

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

Show Detail

ForBiddenError in Node.js/Express.js/Angular2

I am modifying this GitHub sample app to use Express instead of KOA. But I am getting an Access Denied error when the / route in Express tries to load the index.html. What specific changes need t...

Show Detail

Angular CLI Node Express.js

I come from the LAMP world. Greetings. 🖖 I'm trying to get started with the new Angular and Node.js. I already have Node and an Express server installed on my machine. Now I want to use Angular a...

Show Detail

Angular JS Express JS Node JS file upload issue

Please help me I'm new to this and for file upload I referred to this - http://goodheads.io/2015/06/22/handling-file-uploads-using-angularjs-node-and-express/ my implementation is given below. At...

Show Detail

deploying angular universal on node.js express server

angular universal(angular or angular-cli) can be create three part: browser folder ng build --prod to generated static file server folder A server bundle by script(bundle) server.js webpack bun...

Show Detail

Do I need Express.js to use Angular.js with Node.js?

I am new to node.js and at the moment I am trying to wrap my head around template engines. It seems like all the tutorials I find on using Angular.js with Node.js are always accompanied with Expres...

Show Detail

Do we need Node.js and Express.js while working with Angular2?

I built a sample web application using the following - Angular 2 TypeScript ASP.Net WebAPI 2 Mongo DB Karma/Jasmine Node.js (only as a server, just to the extent as specified in Angular2 Qu...

Show Detail

Angular js Expressions not working in Node js project

I have configure node js default project with express and using HTML page instead of JADE. I want to use Angular JS within HTML pages. Angular JS Simple examples are working fine in this project as...

Show Detail

Angular 2 cli with Express js

I want to use express js w/ node js to be my server for an angular 2 project. I was looking at tutorials for integrating express js w/ the angular cli (I followed this and this) and I had no luck....

Show Detail

Node js and Angular js

I am to send a user entered text through Angular js to Node js the issue is the node js server recognizes the event but does not get the data and print it I know I am doing some mistake in the code...

Show Detail