将Laravel 5与AngularJS刀片标签冲突 [英] Using Laravel 5 with AngularJS blade tag conflict
本文介绍了将Laravel 5与AngularJS刀片标签冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Laravel 5设置Angular.
I am trying to setup Angular with Laravel 5.
我尝试在appServiceProvider中进行操作
I have tried doing in appServiceProvider:
public function boot()
{
\Blade::setRawTags("[[", "]]");
\Blade::setContentTags('<%', '%>'); // for variables and all things Blade
\Blade::setEscapedContentTags('<%%', '%%>'); // for escaped data
}
使用:
<div>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<h1>Hello, {{ yourName }}!</h1>
</div>
但是我得到了:
Use of undefined constant yourName - assumed 'yourName'...
推荐答案
在进行与Blade有关的更改(扩展Blade,更改标签等)时,请务必确保删除缓存的视图.
When doing changes that have to do with Blade (Extending Blade, changing the tags etc) always make sure to delete the cached views.
它们位于storage/framework/views
.
只需删除所有文件(.gitignore
除外)
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
这篇关于将Laravel 5与AngularJS刀片标签冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文