imperium2335 imperium2335 - 1 year ago 87
AngularJS Question

Using Laravel 5 with AngularJS blade tag conflict

I am trying to setup Angular with Laravel 5.

I have tried doing in appServiceProvider:

public function boot()
{
\Blade::setRawTags("[[", "]]");
\Blade::setContentTags('<%', '%>'); // for variables and all things Blade
\Blade::setEscapedContentTags('<%%', '%%>'); // for escaped data
}


With:

<div>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<h1>Hello, {{ yourName }}!</h1>
</div>


But I'm getting:

Use of undefined constant yourName - assumed 'yourName'...

Answer Source

When doing changes that have to do with Blade (Extending Blade, changing the tags etc) always make sure to delete the cached views.

They're located in storage/framework/views.

Just delete all files (except the .gitignore)

If you want something a bit more practical you can create a command to do that. Like this one