Controller
app.controller('viewUsersController', function($scope, $http, $cookieStore, $modal) {
$scope.cardsDisplayModeEnabled = true;
$http.get('http://localhost:8080/myapp/user/all?access_token=' + $cookieStore.get("access_token")).
then(function(response) {
$scope.users = response.data;
});
$scope.filterStarWith = function(level) {
var re = new RegExp('^' + "Supervisor", "i");
return level.tfAccessLevel.match(re);
};
})
HTML
<select ng-controller="viewUsersController" ng-model="user.tfSupervisor.id" name="createSupervisor" id="createSupervisor" class="form-control">
<option ng-repeat="level in users | filter:filterStarWith()">{{level.userFirstName}}</option>
</select>
Table : user
Id username accesslevel
1 John Admin
2 Mark Supervisor
3 Chady Admin
I have to list in option whose access level is "Supervisor"
Thanks,