angularjs - express angular ejs passing variable to template -


After login authentication, I am trying to pass message variables for my EJS template:

  App post ('/ login', passport. Authentication ('local-login', {successRedirect: '/ profile', failureRedirect: '/ login', failureFlash: true}));  

Then get the block code:

  if (req.isAuthenticated ()) res.render ('partial /' + name, {message: 'testing' });  

Therefore, the user will be notified if the login fails. Login.ejs will show a partial message, but the message will not appear in the template:

   & Lt ;! - Any messages that come back with certification - & gt; & Lt; Div ng-if = "message.length & gt; 0" class = "alert alert-danger" & gt; {{Message}} & lt; / Div & gt;  

However, when I can see the log message in the admin:

  app.controller ('LoginCtrl', ['$ scope', '$ Http ', function ($ radius, $ http) {console.log (' message: '+ message); // output message: test}]);  

If you want your JSON unsecured to be of - ;

  & lt; Script & gt; Var message = "& lt;% - message%>"; & Lt; / Script & gt;  

But if it is not templating at all, then you have other problems. You JSON.stringify (obj) .

may need to be used

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -