There's a component with 2 inputs - one is set, and the other is just a regular property.
@Input() public set value(val: string) {
this._selectedOption =
this._options.find(o => o[this.selectedProperty || 'someDefault'] === val);
}
@Input() public selectedProperty: string;
In the provided code snippet, the selectedProperty is always empty the first time a value is set.
This is how it looks in HTML:
<my-component [value]="someValue"
selectedProperty="value"
</my-component>
In subsequent appearances of this component, the selectedProperty will be empty.
Is there a way to ensure that the selectedProperty is not empty the first time around?