我正在尝试使用 Laravel 5 设置 Angular。
我尝试在 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'...
最佳答案
最简单的方法是在 Angular 代码前面使用 @:
<div>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<h1>Hello, @{{ yourName }}!</h1>
</div>
关于php - 使用 Laravel 5 与 AngularJS Blade 标签冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28548694/