Thursday, June 25, 2015

Binding model object to Dropdown list

In the post ng-bind directive we saw on how to bind values to simple textbox elements, in this example we shall see on how to bind a list of values to a drop down control.

<html ng-app="bindApp">
    <meta charset="utf-8">
    <title>AngularJS - Basic</title>
    <script src="angular.min.js"></script>
var app = angular.module('bindApp', []);

function bindController($scope) {
    $scope.myLanguages = [
                                      "code": "en",
                                      "name": "English"
                                      "code": "de",
                                      "name": "German"
          <div ng-controller="bindController">
                             ng-options="value.code as for value in myLanguages">
                             Selected Language: {{myLanguage}}


Search Flipkart Products:

No comments: