我看到的所有角度示例都演示了使用文字"when“参数的ng-复数:
<ng-pluralize count="x" when="{'one': 'thing', 'other': 'things'}"></ng-pluralize>是否可以使用范围变量作为when属性?例如:
<ng-pluralize count="x" when="things"></ng-pluralize>将$scope.things设置为{'one': 'thing', 'other': 'things'}的
我试过了,但我在这里指定了它,但我希望我只是遗漏了一些东西,这是可能的。
发布于 2014-03-11 23:52:54
发布于 2014-07-12 21:11:49
所以我刚刚发现,虽然您不能有效地在when属性中放置一个变量(您可以,但是更新不会被反映),但是您可以这样做:
<ng-pluralize count="modalUsers.length"
when="{ 'one': '{{ templateConfig.pluralizeConfig.one }}',
'other': '{{ templateConfig.pluralizeConfig.other }}' }">
</ng-pluralize>然后更新templateConfig对象。
https://stackoverflow.com/questions/22339108
复制相似问题