I have the following HTML
<md-select id="testSelect"
ng-model="objElements" ng-change="onElementChange()"
name="objElements" placeholder="Select Stuff">
<md-option id="testOption"
ng-repeat="ele in Elements"
ng-if="ele.Completed==false"
ng-value=ele.ID
ng-selected="$first">
{{ele.Name}}
</md-option>
Elements
is populated using a $http.get
request and is displaying correctly - I am able to select an element and ng-change
fires correctly.
If I add a new element using a $http.post
, then pushing the new object onto Elements[]
using Elements.push($scope.NewElement)
, is there a way I can set the new object as the 'selected' element?
I can see the new element has been added correctly to the Elements[]
but cannot figure out how to set ng-selected=NewElement
.