AngularJS checkbox dynamic ng-true-value expression

前端 未结 3 623
不知归路
不知归路 2020-12-17 10:19

I\'m trying to build a calculator for daycare prices in Angular.

Every location in the company franchise has separate prices for every day. So my thinking was to bui

3条回答
  •  时光取名叫无心
    2020-12-17 11:04

    It seems ng-true-value does not accept non-constant expressions. From the docs(v1.3.0):

    Some attributes used in conjunction with ngModel (such as ngTrueValue or ngFalseValue) will only accept constant expressions.

    Examples using constant expressions include:

    
    
    

    Examples of non-constant expressions include:

    
    
    

    An ideal workaround probably would be calling a Controller method on ng-click or ng-change inside which you can analyse all the checkboxes for truthy or non-truthy values.

提交回复
热议问题