I'm trying to obtain from the symfony 3 variable to AngularJS to modify and show it, but how I can "share" from the Symfony to AngularJS?.
Let me explain this way When I pass from the Symfony $this->render to the twig and using {{ name.firstName }} it show/works even if I'm using the dump or only the var, but I don't have idea to how pass to AngularJS the data of the variable "name.firstName" to modify in AngularJS, can anybody help me ???
(to clarify I'm not using JQuery or another thing, only JS, AngularJS, and Symfony3)
Here my code:
CheckController.php
/**
* @Route("/payment", name="PaymentCheck.payment")
* @return Response
*/
public function indexAction(Request $request): Response
{
$customer = $this->getCustomer();
/.../ more code /.../
return $this->render(':PaymentCheck:index.html.twig', [
'customerProfile' => $customer, //<---- variable
'order' => $recalculatedOrder->getOrder(),
'form' => $clickToCallForm->createView(),
]);
}
index.twig.html
<div ng-if="shippingOptions.currentTab == 'homeDelivery'">
<div class="address-book-section">
<div class="choose-address">{{ 'PaymentCheck.select_shipping_address'|trans }}</div>
{# it show, but how can I pass the variable to AngularJS? the customerProfile one #}
{{ dump(customerProfile) }}
<address-book type="shipping" creatable="true" selectable="true"></address-book>
</div>
<div ng-repeat="package in PaymentCheck.order.packages">
{% include ':PaymentCheck:itemList.html.twig' with {onlyUndeliverables: true} %}
</div>
</div>