I'm trying to create a dropdownbox for choosing language using bootstrap and angularjs.
By default,the option in the dropdownbox should be populated with English.If I choose other language,the dropdownbox should be populated by that corresponding language.
How can I achieve this?Can anyone please help me out regarding this issue ...
My js code:
angular.module('Sample', [ 'ngAnimate', 'ui.bootstrap' ]);
angular.module('Sample', []).controller('Home', function($scope) {
$scope.languages= [ 'English', 'Telugu', 'Hindi', 'Tamil' ];
});
My html code :
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button"
id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="true">
Language <span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li ng-repeat="a in languages"><a href="#">{{a}}</a></li>
</ul>
</div>