Laravel {!! Form::open() !!} doesn't work within AngularJS

I'm using Laravel 5.0 + AngularJS to build some website. The problem is when I use laravel illuminate, things like

{!! Form::open() !!}
{!! Form::close() !!}

are not compiled into forms, instead, the plain texts are displayed.

I guess it's because I'm also using angular, which already have certain use of '{}';

when I use {!! Form::open() !!} in another page with no angular it works normally.

How can I use laravel form inside angular app? (need the features like csrf token)


You will either need to change the blade syntax for laravel or change it for AngularJS. I tend to lean on changing it for Lavavel.

Blade::setContentTags('<%', '%>');        // for variables and all things Blade
Blade::setEscapedContentTags('<%%', '%%>');   // for escaped data

Add that into a common file, such as routes.php.

Update your references from {!! to <% and !!} to %>.


If you would instead like to do this on the AngularJS side, you can with adding this into your app.js file (credits:

var sampleApp = angular.module('sampleApp', [], function($interpolateProvider) {

Replace the module name with your project's app module name.

js interview questions