ng-disabled 在更改时不影响输入 enabled/disabled

ng-disabled not affecting input enabled/disabled when being changed

我正在尝试对输入(文本或数字)使用 ng-disabled

<input ng-disabled="{{attribute.selected}}"...

我看到它在绑定到复选框时工作,但我似乎无法在这里工作。

我试过没有 {{}} 但标记只包含 'attribute.selected' 而不是 true 或 false

单击 md-checkbox 时,我可以在 chrome 开发工具中看到该值正在更改。 ng-disabled="true" 然后 ng-disabled="false"

当使用 !attribute.selected 时,输入被禁用并且当值变为真时不会重新启用。

完整片段:

    <md-content layout-padding layout-xs="column">
        <md-checkbox md-ink-ripple="#2199FF" id="attr{{attribute.id}}" ng-model="attribute.selected">
            {{attribute.name}}
        </md-checkbox>

        <md-content layout-padding ng-repeat="property in attribute.properties">

            <md-input-container >
                <label>{{property.name}}</label>
                <input ng-disabled="{{attribute.selected}}" md-maxlength="{{property.maxLength}}" type="{{property.type}}" required name="{{property.name}}" ng-model="property.value">
                <div ng-messages="Required">
                    <div ng-message="required">This is required.</div>
                    <div ng-message="md-maxlength">Max {{property.maxLength}} digits</div>
                </div>
            </md-input-container>

        </md-content>
    </md-content>

</div>

将 ng-disabled="{{attribute.selected}}" 更改为 ng-disabled="attribute.selected"

<md-content layout-padding layout-xs="column">
    <md-checkbox md-ink-ripple="#2199FF" id="attr{{attribute.id}}" ng-model="attribute.selected">
        {{attribute.name}}
    </md-checkbox>

    <md-content layout-padding ng-repeat="property in attribute.properties">

        <md-input-container >
            <label>{{property.name}}</label>
            <input ng-disabled="attribute.selected" md-maxlength="{{property.maxLength}}" type="{{property.type}}" required name="{{property.name}}" ng-model="property.value">
            <div ng-messages="Required">
                <div ng-message="required">This is required.</div>
                <div ng-message="md-maxlength">Max {{property.maxLength}} digits</div>
            </div>
        </md-input-container>

    </md-content>
</md-content>