Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Last active August 29, 2015 14:11
Show Gist options
  • Save shadowhand/0bb2bf370462fa0ba227 to your computer and use it in GitHub Desktop.
Save shadowhand/0bb2bf370462fa0ba227 to your computer and use it in GitHub Desktop.
Angular JS select
$scope.changedRole;
$scope.changeRole = function() {
if (confirm('Are you sure you want set the role of selected users to ' + $scope.changedRole + '?')) {
alert('TODO [ not implemented ]');
}
};
$scope.roles = [
{
name: 'guest',
display_name: 'Guest',
},
{
name: 'user',
display_name: 'Member',
},
{
name: 'admin',
display_name: 'Admin',
}
];
<select ng-disabled="!selectedUsers.length" ng-model="changedRole" ng-change="changeRole()"
ng-options="role as role.display_name for role in roles">
<option value>Change Role...</option>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment