I'm working on a component that includes a dropdown selection menu.
<p style="padding: 5px">
<select [(ngModel)]='thisDD' name="nameDD" id="idDD" (ngModelChange)="updateDD(thisDD)" class="form-control">
<option *ngFor="let thing of thingies" [value]="thing.thingID">{{thing.ThingName}} ({{thing.ThingCode}})</option>
</select>
</p>
In addition, I have an @Output EventEmitter in this component:
@Output() selectedValue = new EventEmitter<object>();
This component is used in my app like so:
<my-dropdown (selectedValue)="setValue($event)"></my-dropdown>
The "setValue" function gets called when the dropdown value changes:
setValue(event){
this.currValue=event;
}
While this works well for changing values, I need to also retrieve the default value of the component when loading other components that rely on it.
Is there a way to access the default value through the @Output? Any suggestions on how to achieve this?