css - "\'“在ng风格中意味着什么?

标签 css angularjs

下面代码中的“\”是什么意思?

<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 }">&nbsp;</div><div ng-cell></div></div>',

我也不明白为什么在第一个ng-style代码中使用\',而在第二个ng-style代码中代码直接使用高度而不使用\'。

代码取自 https://github.com/angular-ui/ng-grid/issues/994

最佳答案

\ 转义紧跟其后的单引号。

关于css - "\'“在ng风格中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23830289/

相关文章:

javascript - 如何在 angularjs 中的每个特定计数后注入(inject)数据

javascript - AngularJS : how to use ng-change in factories?

javascript - AngularJS:单选复选框模型不会改变

javascript - 将元素始终定位在死点的流体图像上方?

javascript - 如何证明angular服务是单例的?

AngularJS:如何验证 ng-repeat 表单字段

html - :hover acting funny 上的背景图像 (SVG) 更改

css - 多级动态弹出菜单

html - 试图在 twitter bootstrap 2.3.2 行/跨度中对齐三个图像

javascript - 使用jquery动态创建div会导致语法错误