javascript - How to assign a php json variable to angular without a rest call? -
i want load initial page php, instead of making rest call variable, have variable in page , need way assign angular. saw different ways doing like
<.....ng-init="somefunction('<?echo $myjsonstring?>')">
but not working thinks json string ends @ first double codes .i though replace double codes special symbol , in angular replace require processing think reduce performance. there other way this?
try json_encode
:
<...ng-init="somefunction('<?php echo json_encode($myjsonstring); ?>')">
Comments
Post a Comment