Just like a normal select control, the ng-option should have a boolean selected attribute to make it the selected one.
<ng-select>
<ng-option [value]="1">First option</ng-option>
<ng-option [value]="2" [selected]="true">Second option</ng-option>
</ng-select>
why you need selected attribute? If you want it selected then just set ngModel 馃
For visual consistency, it is desirable to use ng-select in lieu of a normal select and be able to script it the same way. The ng-option tags are emitted using *ngFor and the selected attribute could be determined from a field where using the model would require going through the collection in advance and determine the item.
I believe it would be very practical. At the same time I would like to suggest to allow option as a synonym for ng-option.
Since issue: https://github.com/ng-select/ng-select/issues/899 I'm trying to preselect first option when ng-select opens first time, but I've found that "selected" is not an @Input that I can use for that case. Can you please add it in a new version, that will be very useful.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions :fireworks:
Most helpful comment
Since issue: https://github.com/ng-select/ng-select/issues/899 I'm trying to preselect first option when ng-select opens first time, but I've found that "selected" is not an @Input that I can use for that case. Can you please add it in a new version, that will be very useful.