How to use AngularJs Inside the Scala template? -


i'm trying show image database. however, can't put angular variable inside @ sign of scala template.

<div class="col-sm-6 col-md-3" ng-repeat="product in products">     <a href="#">         <div class="thumbnail">             <img class="img-responsive" ng-src="@routes.bookstore.getimage(product.name)">             ...         </div>     </a> </div> 

it gave error: can't find product variable. tried:

 <img class="img-responsive" ng-src="@routes.bookstore.getimage( {{ product.name }} )"> 

it still gave me same error. how can use angularjs variable inside scala template?

you can not that's obvious - scala template processed @ backend side much, earlier arrives frontend. instead angular app should have method create string containing path image literally, /book-store/get-image/foo.jpg , add route routes file:

get /book-store/get-image/:filename   controllers.bookstore.getimage(filename) 

optionally can try go javascriptroutes, it's not necessary.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -