JSFiddle - React, Tailwind, and code Playground

by Nilesh Injulkar

HTML

<div ng-controller='NewSelectController'>
<select class="selectpicker" id="inputSystemLoggingId" 
data-html="true" ng-init="initDataSources()" ng-options="a.id for a in systemLoggingIds" 
ng-model="systemLoggingId">
</select>
</div>

JavaScript

var startAppModule = angular.module('startApp',[]);
startAppModule.controller('NewSelectController', function($scope, $http){
$scope.systemLoggingId = "4";
$scope.systemLoggingIds = [{"id":"4"}];

$scope.initDataSources = function() {

    $http({
        method: 'get',
        url: '/amenityLogging/getSystemLoggingIds'
    }).success(function (listSystemLoggingIds) {
        console.log($scope.systemLoggingIds);
        $scope.systemLoggingIds = [{"id":"5"}];
        $scope.systemLoggingId = "5";
        console.log($scope.systemLoggingIds);
        $('#inputSystemLoggingId').selectpicker();
    });
}
});