Im following this doc for md-select initial value setting. But i would like to set the value of md-select programmatically through buttons.
md-select
Here is what ive'd done so far DEMO
md-select is expecting object value to be there in selectedUser, where as filter does return array of filtered object. You should be assigning 1st element of filtered array by doing [0] of filtered result.
selectedUser
filter
[0]
$scope.selectedUser = $scope.users.filter(function(user) { return user.id == id; })[0];
Forked Codepen
Copyright © 2021 Jogjafile Inc.
md-select
is expecting object value to be there inselectedUser
, where asfilter
does return array of filtered object. You should be assigning 1st element of filtered array by doing[0]
of filtered result.Forked Codepen