在此配置中使用时,有没有人注意到ng-repeat的问题:
<div ng-repeat="row in home.grid.view = (home.grid.data | orderBy:ctrl.contentOrderBy[ctrl.configService.admin.contentOrderBy].key:ctrl.configService.admin.contentSortDirection)">
Run Code Online (Sandbox Code Playgroud)
这是我的contentOrderBy对象:
[{"id":0,"name":"CId","key":"contentId"},
{"id":1,"name":"Modified By","key":"modifiedBy"},
{"id":2,"name":"Modified Date","key":"modified"},
{"id":3,"name":"Status","key":"contentStatusId"},
{"id":4,"name":"Status > Type","key":["contentStatusId","contentTypeId"]}]
Run Code Online (Sandbox Code Playgroud)
ctrl.configService.admin.contentSortDirection有两个值:0或1
我的问题是当我尝试更改为configService.admin.contentSortDirection时:
我已经检查了最新的文档,除非有误,我找不到任何关于如何做订单的事情,我以前曾在以前的文档中看到过.
如果有其他人知道这样做的工作方式,我将不胜感激任何建议.我也想知道为什么ng-repeat文档看起来有点缺乏.
小智 6
换行:
<div ng-repeat="row in home.grid.view = (home.grid.data | orderBy:ctrl.contentOrderBy[ctrl.configService.admin.contentOrderBy].key:ctrl.configService.admin.contentSortDirection)">
Run Code Online (Sandbox Code Playgroud)
至:
<div ng-repeat="row in home.grid.view = (home.grid.data | orderBy:ctrl.contentOrderBy[ctrl.configService.admin.contentOrderBy].key:ctrl.configService.admin.contentSortDirection == 1)">
Run Code Online (Sandbox Code Playgroud)
Harish在正确的轨道上,但他设置反向参数的方式是完全错误的:
reverse=order.dir === 1
Run Code Online (Sandbox Code Playgroud)
没有要求"反向=".
您的问题是由Beta 14版本中的此更改引起的:
fix(core): drop the toBoolean function
So far Angular have used the toBoolean function to decide if the parsed value
is truthy. The function made more values falsy than regular JavaScript would,
e.g. strings 'f' and 'no' were both treated as falsy. This creates suble bugs
when backend sends a non-empty string with one of these values and something
suddenly hides in the application
Thanks to lgalfaso for test ideas.
BREAKING CHANGE: values 'f', '0', 'false', 'no', 'n', '[]' are no longer
treated as falsy. Only JavaScript falsy values are now treated as falsy by the
expression parser; there are six of them: false, null, undefined, NaN, 0 and "".
Closes #3969
Closes #4277
Closes #7960
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
206 次 |
| 最近记录: |