Monday, May 28, 2018

“md-select” - How to set a selected option of a dropdown list control using angular JS?

Try this following code to set selected value based on selected index.

<div layout="row" flex layout-align="start">
	<md-input-container flex>
		<label>{{'TicketType_Label'| translate}}</label>
		<md-select ng-model="feedbackObj.ticketType"  ng-required="true" md-no-asterisk="false" >
			<md-option ng-selected="i == 0 ? true:false"  ng-repeat="(i,type) in TicketTypes" >{{type}}</md-option>
		</md-select>					
	</md-input-container>
</div>

No comments:

Post a Comment