After adding "multiple = true" to my select, it's adding an array of objects to the model instead of each object separately.
This is what I want:
{
teams: [
{name: 'team1'},
{name: 'team2'},
{name: 'team3'}
]
}
But instead I'm getting
{
teams: [
{name: 'team1'},
{name: ['team2','team3']}
]
}
Pic of data structure issue.
2 Teams put in manually are objects. Teams put in using md-select are an array within an object.
$scope.baseGitblituser = {
CODE HERE DELETED FOR READABILITY, WAS FOR OTHER USER FIELDS
teams:
[{name: "xignorex All Users"},
{name: "Test Users"}]
};
This initiates the scope for the user and adds the global teams manually that all users will contain.
// this is created elsewhere using $scope.gitblitUser = angular.copy($scope.baseGitblituser);
$scope.gitblitUser.teams.push({name:user.team});
This is part of the function that is called when the md-select button is clicked to create a new user. This is how the teams array is updated with new teams.
<md-select ng-model="user.team" multiple="true" name="teams" placeholder="your default team " style="min-width: 200px;">
<md-optgroup label="">
<md-option ng-value="team.name" ng-repeat="team in teams">{{team.name}}</md-option>
</md-optgroup>
This is the HTML portion.
$scope.baseGitblituser
not the same as$scope.gitblitUser
? or how does one become the other?