nirvair
nirvair

Reputation: 4180

Overriding Laravel 5 delimiters

I am using AngularJS with Laravel in my application. The problem that is face is both of them use the same delimiter.

I want to override Laravel's delimiter.

Upvotes: 1

Views: 168

Answers (2)

haakym
haakym

Reputation: 12358

To add to limonte's answer, you can add @ at the beginning of any angular statement that uses the handlebars so blade won't touch it, this can be a good work around if you don't want to completely replace the handlebars.

Example:

@{{ $scope.var }} // won't be read by blade!

See docs for more info: http://laravel.com/docs/5.0/templates

Upvotes: 0

Limon Monte
Limon Monte

Reputation: 54419

Add these lines to AppServiceProvider@register:

Blade::setEscapedContentTags('[[', ']]'); 
Blade::setContentTags('[!!', '!!]');. 

After this your will be able to use variables in templates like this:

[[ $phpVar ]]    // PHP
{{ angularVar }} // AngularJS

Upvotes: 2

Related Questions