Description
I'm submitting a bug/feature request (check one with "x")
[x] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
Have a look at that, (demo: http://plnkr.co/edit/P25dYPC5ChRxpyxpL0Lj?p=preview):
@Component({
selector: 'my-app',
providers: [],
template: `
<div [formGroup]="form">
<input formControlName="first" [disabled]="isDisabled">
</div>
`,
directives: []
})
export class App {
isDisabled = true
form = new FormGroup({
'first': new FormControl('Hello')
})
}
There is a warning message asking to refactor the code, but more importantly, the input is unfortunately not disabled. Refactoring the code to what is suggested is not helping either, i.e. doing this will not work, (demo: http://plnkr.co/edit/Gf7FGR42UXkBh6e75cm2?p=preview):
@Component({
selector: 'my-app',
providers: [],
template: `
<div [formGroup]="form">
<input formControlName="first">
</div>
`,
directives: []
})
export class App {
isDisabled = false
form = new FormGroup({
'first': new FormControl({value: 'hello', disabled: this.isDisabled})
})
constructor() {
setTimeout(() {
this.isDisabled = true
}, 10)
}
}
Expected/desired behavior
After the callback of the setTimeout is executed, the input should be disabled, but it is not.
Reproduction of the problem
Yes, please look here: http://plnkr.co/edit/P25dYPC5ChRxpyxpL0Lj?p=preview
What is the motivation / use case for changing the behavior?
To have the same behaviour, or similar one than in RC5. At least, we shall have a possibility, even if it's a breaking change, to set dynamically the disabled
attribute. As of now, it does not seem possible anymore.
Please tell us about your environment:
- Angular version: 2.0.0-rc.6
- Browser: [ Chrome 52 ]
- Language: [ TypeScript ]