bradtraversy / node_passport_login

Node.js login, registration and access control using Express and Passport
1.74k stars 1.29k forks source link

view engine #10

Closed xubingyang closed 5 years ago

xubingyang commented 7 years ago

I am trying to change the view engine to EJS. But I have some trouble with this part. `

{{#if success_msg}}
{{success_msg}}
{{/if}} {{#if error_msg}}
{{error_msg}}
{{/if}} {{#if error}}
{{error}}
{{/if}} {{{body}}}
        </div>`

any help?

gabru-md commented 7 years ago

@xubingyang You are trying to use a completely different View Engine. You can try changing the syntax according to EJS View.

Try using the code below:

<div class="rows"> <div class="col-lg-12"> <%= if(success_msg.length > 0){ %> <%= success_msg.forEach(function(msg){%> <div class="alert alert-success"><%= msg %></div> <%= }) %> <%= } %> <%= if(error_msg.length > 0){ %> <%= error_msg.forEach(function(err_msg){%> <div class="alert alert-success"><%= err_msg %></div> <%= }) %> <%= } %> </div></div> In any case of problem please contact.

PS: I am a beginner as well.