简体   繁体   中英

How to make a multiplication between a twig variable and an angularjs variable

I want to do it quickly without controller if possible.

在此处输入图片说明

I have a twig template where I can access a variable: price. Here, for example, the price is equal to 150. I create a select with 5 options as below. And I want to have the total but I have a "Warning: A non-numeric value encountered".

<select name="total" ng-model="total">
    <option value="1">1</option>
    <option value="2">2</option>
</select>
${{ price }}
${{ '{{ total }}' * price }}

Help!

set the value of price in a js var and use it in angular

<script>
var myPrice="{{phpPrice}}";
</script>

Than perform your calc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM