I'm trying to learn the Angular 2. I have a simple material input tag and I wish to set it's value on a conditon.
<md-input value="dataSelected ? {{selectedDataName}} : ''"></md-input>
I tried to set [value] or dataSelected as {{dataSelected}} or (dataSelected) but it doesn't do the trick. Can someone lead me into right direction?
Instead of value="dataSelected ? {{selectedDataName}} : ''"
you can set it value
with below possibile ways :
<md-input [attr.value]="dataSelected ? selectedDataName : ''"></md-input>
or
<md-input [value]="dataSelected ? selectedDataName : ''"></md-input>
or
<md-input value="{{dataSelected ? selectedDataName : ''}}"></md-input>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With