0

I want to do it quickly without controller if possible.

enter image description here

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!

Junior Gantin
  • 2,102
  • 1
  • 18
  • 24

1 Answers1

1

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

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

Than perform your calc.

TexWiller
  • 318
  • 2
  • 9
  • It's works, but I need to create a scope variable and a controller like explained [here](https://stackoverflow.com/questions/19383725/how-to-access-global-js-variable-in-angularjs-directive) – Junior Gantin Oct 28 '17 at 08:03