【发布时间】:2015-01-18 03:51:02
【问题描述】:
我试图从我的数据库中提取数据以显示到一个表单中,但我不断收到此错误 错误:[$parse:lexerr] http://errors.angularjs.org/1.2.21/$parse/lexerr?p0=Unterminated%20quote&p1=s %2055-56%20%5B'%5D&p2=report.incidentTime%20%3D'Couple'sNaNispute%20at%20Robinson%20Hall'。我在这个网络应用程序中使用 laravel 和 angularjs(混合方法)。
HTML
<div class="col-xs-4 col-sm-4 col-md-4">
<div class="form-group" data-ng-class="{'has-error': documentIncident.reportTitle.$invalid && documentIncident.reportTitle.$dirty}">
<label for="incidentTime">Report Title</label>
<input type="text" name="reportTitle" ng-model="report.reportTitle" ng-init=" report.incidentTime ='{{$reports[0]->reportTitle}}'" autocomplete="off" ng-minlength="6" class="form-control input-sm" required>
</div>
</div>
数据库数据
我遇到的问题是撇号阻止了数据的显示。有没有办法解决这个问题,无论是通过过滤、转义还是任何其他方法?
【问题讨论】:
-
不要从 view::make() 传递 $reports。创建服务并通过 Angular 服务将 $reports 提取为 json,然后像这样使用:reports[0].reportTitle