Dropdown/select list controller - setting logged in user as the default user

15 views
Skip to first unread message

Dawg

unread,
Mar 24, 2017, 4:43:18 PM3/24/17
to Angular and AngularJS discussion
Hello,

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?

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>


Sander Elias

unread,
Mar 25, 2017, 4:52:48 AM3/25/17
to Angular and AngularJS discussion
Hi,

In your controller, assign loggedInMember to memerList
Reply all
Reply to author
Forward
0 new messages