下面代码中的“\”是什么意思?
<div ng-style="{ \'cursor\': row.cursor }"
为什么不能写
<div ng-style="{ cursor: row.cursor }"
完整代码
rowTemplate: '<div ng-style="{ \'cursor\': row.cursor }" ng-repeat="col
in renderedColumns" ng-class="col.colIndex()" class="ngCell {{col.cellClass}}"
style="overflow: visible"><div class="ngVerticalBar" ng-style="{height: rowHeight}"
ng-class="{ ngVerticalBarVisible: !$last }"> </div><div ng-cell></div></div>',
我也不明白为什么在第一个ng-style代码中使用\',而在第二个ng-style代码中代码直接使用高度而不使用\'。
最佳答案
\
转义紧跟其后的单引号。
关于css - "\'“在ng风格中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23830289/