NVO NVO - 3 months ago 18
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]
http://errors.angularjs.org/1.4.7/$parse/lexerr?p0=Unterminated%20quote&p1=…ttp%3A%2F%2Fs3-eu-west-1.amazonaws.com%2F***bucket***item.product.image1

Answer

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:

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