Eogcloud
Eogcloud

Reputation: 1365

conditional jade, DOM object values

The following is an excerpt from a Jade template

        .row
            .col-xs-2
            -if(message.length>0)
                .alert.alert-danger.col-xs-4

1. I'm trying to have the conditional but have it on the same level as the .col-xs-2 div, not inside it. Is there a way to do this?

2. How do I give the .alert div the Value of the message string in the conditional?

Upvotes: 0

Views: 93

Answers (1)

azurelogic
azurelogic

Reputation: 786

It seems that this is what you're looking for.

    .row
        if(message.length>0)
            .col-xs-2      
                .alert.alert-danger.col-xs-4 #{message}

You may need this instead though for the alert:

                .alert.alert-danger.col-xs-4= message

Upvotes: 1

Related Questions