NVO NVO - 1 year ago 136
Node.js Question

Angular inline conditon

I have the following row in my jade file

img(src="{{ item.product.image1.match('http') ? item.product.image1 : 'http://s3-eu-west-1.amazonaws.com/#{_awsbucket}item.product.image1 }}'", alt='{{item.product.productNumber}}')

As you can see, I want to add http://s3-eu-west-1.amazonaws.com/{bucket} as src when the URL does not contain 'http'.
This condition fails, (angular error), but I can't see any errors. Maybe someone have an idea?

angular.js:12477Error: [$parse:lexerr]

Answer Source

I guess the problem is here:

'http://s3-eu-west-1.amazonaws.com/#{_awsbucket}item.product.image1 }}'"

you have placed a quote in the wrong place. replace it with:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download