I have a select/dropdown controller with a list of names populated at initial startup and this works.
What I like to do is to have the select controller have the logged in user as the default user selected/displayed.
for example, loggedInMember = 3 (3 representing the index number of the user who is logged in).
If possible, I also like to minimize the coding in the html to keep it clean.
So, the question is how do i go about doing that?
any help you can provide would be greatly appreciated
form.component.html
<div class="form-group">
<label class="control-label" for="drp_severityID">Assign incident to: (default To: Mike Smith)</label>
<select class="form-control" formControlName="memberList">
<option *ngFor="let mem of getMemberList" [value]="mem.usr_index">{{mem.usr_firstname}} {{mem.usr_lastname}}</option>
</select>
</div>
Thanks for the reply back Pullo. I’m somewhat new to angular and not sure how to incorporate your answer into my code. having said that I should have added more of my code into the post…
I added more code below and could you have a look and let me know how to incorporate it into my code?
<div class="form-group">
<label class="control-label" for="drp_severityID">Assign incident to: (default To: Mike Smith)</label>
<select class="form-control" formControlName="memberList">
<option *ngFor="let mem of getMemberList" [value]="mem.usr_index">{{mem.usr_firstname}} {{mem.usr_lastname}}</option>
</select>
</div>
I apologize for that replay, it wasn’t that I’m ignore your replies infect I greatly appreciate your replies.
I’m new to Angular and most likely your answers are what I need to fix my issue but due to my understanding of Angular its bit; for better word advanced and short…
I was able to figure it out and get the code to work. when back to your post and looked at it little bit more, I kind knew you were on the right track and with little trial and error i got it to work.
I tried both free and payed tutorials and they were all great in there own right but they can only do so much.
Just like school, you learn much as you can but when you hit the real world, things aren’t so scripted like tutorials are.
I started a little project and see where it takes me.
After searching gGithub I decided to start a little project creating a bug tracking application. yes, we need another bug tracking software
It seems to have a little bit of everything so see where it goes…