Thursday, 16 March 2017

Dynamic flash messages in jade

I am trying to make a dynamic page where the flash messages are only shown when there's an actual flash message.

The text of the message is only shown when the if statement is true, but the div with it's background color is always shown (the classes are bootstrap). I also tried adding custom CSS to the div's but the same problem appears.

The template engine I am using is Jade with Express.

div.wrapper  
      if success_msg
        div.alert.alert-success #{success_msg}      
      if error_msg
        div.alert.alert-danger #{error_msg} 
      if error
        div.alert.alert-danger #{error}   

      block content



via DowinskiField

No comments:

Post a Comment