ng-show> 10引发语法错误(VS浏览器链接) [英] ng-show > 10 throws syntax error (VS browser link)
问题描述
我有一个表格单元格,用于显示是否有10条以上的记录.我分页的一部分.
I have a table cell that shows if there's more than 10 records. Part of my pagination.
<td ng-show="totalRecords>10" colspan="5">
<ul uib-pagination style="margin:0;" total-items="totalRecords" ng-model="currentPage" ng-change="pageChanged()"></ul>
</td>
非常简单.但这很疯狂-它在Chrome中引发以下错误:
Pretty straightforward. But here's the crazy - it throws the following error in Chrome:
Uncaught Error: Syntax error, unrecognized expression: td[ng-show='totalRecords @ browserLink:37
bc.error @ browserLink:37
bh @ browserLink:37
bp @ browserLink:37
...etc
我会注意到在控制器中$scope.totalRecords
设置为零(0
).将其设置为其他值不会更改任何内容.控制器中的其他所有功能均正常运行.
I'll note that $scope.totalRecords
is set to zero (0
) in the controller. Setting it to other values doesn't change anything. Everything else in the controller works perfectly.
以下情况不会引发任何错误:
The following scenarios don't throw any error:
<td ng-show="totalRecords=10" colspan="5">...</td>
<td ng-show="totalRecords<10" colspan="5">...</td>
<td ng-show="totalRecords>9" colspan="5">...</td>
<td ng-show="totalRecords>=11" colspan="5">...</td>
<td ng-show="totalRecords" colspan="5">...</td>
任何人都对为什么有一个猜测?
Anyone have a guess as to why?
推荐答案
问题出在Visual Studio的浏览器链接"功能上,这可能导致AngularJS出现问题.根据我对您遇到的错误所做的研究,似乎人们建议禁用Visual Studio中的浏览器链接功能.
The problem is with Visual Studio's "browser link" feature which can cause problems with AngularJS. Based on some research I did about the error you are experiencing, it seems that people are recommending to disable the browser link feature in Visual Studio.
以下链接包括对您所犯错误的类似描述,以及几种禁用浏览器链接功能的方法:
The following link includes a similar description of the error you have and a few ways to disable the browser link feature: