Search example

Tutorial 28 - Angularjs listbox example

Angularjs listbox example

This sample will help you know about using combobox via AngularJS. Ok we will answer two questions blow:

How to binding data to listbox?
How to get seclected value of listbox?
   <title>AngularJS combobox</title>  
   <script src=""></script>  
 var app = angular.module('myapp', []);  
 app.controller('ctrlMonth', function($scope) {  
  $scope.months = ['January','February','March','April','May','June','July','August','September','October','November','December'];  
     body {  
       background-color: #000;  
       font-family: Arial, sans-serif;  
       color: #fff;  
     .sample {  
       width: 400px;  
       margin: 0 auto;  
       border: 1px solid #aaa;  
       padding: 20px;  
       margin-top: 20px;  
 <body ng-app="myapp">  
   <div class="sample" align="center" ng-controller="ctrlMonth">  
     <h1>AngularJS Listbox example</h1>  
     <select style="width: 100%;" size="7" ng-model="currentItems" multiple  
         ng-options="opt as opt for opt in months"></select>  
     <h3>You have selected: {{currentItems}}</h3>  


Run it



Related post to angularjs listbox example


Angularjs select option with custom format value

Angularjs select option with image

Multi select listbox with dynamid ng-selected value example

angularjs dual listbox

1 comment:

  1. I was looking for this certain info for a long time. Thank you

    Hire Angular Developers


Popular Posts