Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm using node.js and passport for authentication, and I need to send 'login failed' message to the client if a user failed to authenticate. My application uses also express middleware. I'm using angular.js in the client.

Currently I'm using that command to show a static html:

var loginStatus = 'Failed';
res.sendfile('views/login.html'); // What should I add/change here in order to send the loginStatus variable ?

And this is my angular.js controller:

function MainController($scope) {
   $scope.loginStatus = // What should I write here in order to get 'Failed' ?
}

I've posted my questions on the remarks above.

share|improve this question
    
you can't. you can only use angular.js to call node.js api and get the returned data using a callback. –  zsong Aug 5 '13 at 13:59
    
So I need to configure the route for the login.html on my controller template ? If I do that, how can I get a callback from the server ? –  ohadinho Aug 5 '13 at 14:15
    
yes. you should use angular to handle routings. angualr is a selfcontained mvc framework, your node.js becomes just your SOA layer. –  zsong Aug 5 '13 at 14:17
    
ok, so how do I get a callback from the server ? –  ohadinho Aug 5 '13 at 14:25
    
You're using express right? –  dcodesmith Aug 5 '13 at 14:37
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.