Skip to content

Instantly share code, notes, and snippets.

@narenaryan
Created November 25, 2016 09:51
Show Gist options
  • Select an option

  • Save narenaryan/1705de848e9baffa5e5bf2c840905841 to your computer and use it in GitHub Desktop.

Select an option

Save narenaryan/1705de848e9baffa5e5bf2c840905841 to your computer and use it in GitHub Desktop.
Angular JS implementation of Bootstrap Select
var app = angular.module('sampleApp');
// add this directive to your app
app.directive( 'bootstrapSelect', [function() {
return {
restrict: 'A',
link: function( scope, elem, attrs ) {
elem.ready(function(){
elem.selectpicker();
});
}
}
}]);
<!-- In HTML add bootstrap-select directive to select element -->
<select class="form-control" bootstrap-select>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment