我在我的模型中的按键排列,以及“NG-如果”在模板中为每个按钮:NG-如果没有按预期工作
self.aButtons.push({
label: __('Siguiente'),
class: 'btn-moduloAvance',
show: (self.oContrato.definirPago || self.oContrato.horario_definido)
}
});
这就是HTML:
<button ng-if="boton.show"
ng-repeat="boton in personaAndContrato.aButtons"
type="button"
ng-class="boton.class"
/>
我知道我给'show'属性分配了一个布尔值,所以它不可能改变,因为它是一个简单的类型。
通过我想要的功能分配到 '显示' 属性,但我得到下面的错误方式:
self.aButtons.push({
label: __('Siguiente'),
class: 'btn-moduloAvance',
show: function() {
return (self.oContrato.definirPago || self.oContrato.horario_definido);
}
});
HTML(编辑):
<button ng-if="boton.show()"
ng-repeat="boton in personaAndContrato.aButtons"
type="button"
ng-class="boton.class"
/>
TypeError: v2.show is not a function at fn (eval at compile (angular.js?version=alpha.1:14539), :4:240)
有些想法?我是否错过或误解了某些东西?
提前致谢!
NG-秀是那么突兀比NG-如果最终的结果是相似的,但接受与NG-重复使用 –