angularjs - Using ng-options for select input -
i using ng-options select input.but not populating drop down list.i using materialize css css framework.
here code
<div class="col s6" > <select ng-options="bucket.id bucket.name bucket in buckets track bucket.id" ng-model="new_transaction.bucket"></select> </div> js code
$scope.new_transaction = { "bucket":"" } $scope.buckets = [ { id:1, name:"bucket-1" }, { id:2, name:"bucket-2" } ] $(document).ready(function() { // "href" attribute of .modal-trigger must specify modal id wants triggered $('select').material_select(); }); note :there no errors in console. , inspect element on dropdown element shows me
<div class="select-wrapper"> <span class="caret">▼</span> <input type="text" class="select-dropdown" readonly="true" data-activates="select-options-b1cded87-bee7-c9cd-5564-c613f7439e7a" value=""> <ul id="select-options-b1cded87-bee7-c9cd-5564-c613f7439e7a" class="dropdown-content select-dropdown" style="width: 294px; position: absolute; top: 0px; left: 0px; opacity: 1; display: none;"> </ul> <select ng-options="bucket.id bucket.name bucket in buckets track bucket.id" ng-model="new_transaction.bucket_id" class="initialized ng-pristine ng-untouched ng-valid"><option value="?" selected="selected"></option> <option label="bucket-1" value="1">bucket-1</option> <option label="bucket-2" value="2">bucket-2</option></select>
you can apply
$('select').material_select(); only when ready ngoptions directive done. simplest , used solutions put plugin init inside $timeout:
$timeout(function(){ $('select').material_select(); })
Comments
Post a Comment