Knockout attr binding with attributes like 'readonly' and 'disabled'

前端 未结 3 1513
粉色の甜心
粉色の甜心 2020-12-06 16:36

What\'s the suggested \"best practice\" way to use Knockout\'s \"attr\" data binding with standalone attributes like \"readonly\" and

3条回答
  •  天命终不由人
    2020-12-06 16:45

    Knockout's "attr" data binding does support this scenario just return null or undefined from your getDisabledState() function then it won't emit the attribute.

    Demo Fiddle.

提交回复
热议问题