I'm using angular with laravel and in my blade templates I want to do a quick and dirty assignment like so:
ng-init="product = {{$product}}"
However a problem with this approach is laravel/php outputs the json in double quotes. I'm required to use single quotes due to ng-init=""
on the outside. I've tried str_replace('"', "'", $product)
but its only a matter of time until I run into a value with an apostrophe. Is there any solutions to this?
Note: I'm well aware that this is bad practice but its a quick and dirty solution to a couple of pages, also saves me time and the client money.