Home > DeveloperSection > Forums > how to Bind (Set) Dropdownlist Value and Text using ng-Options or ng-Repeat Angularjs
Ankit Singh

Total Post:341

Points:2389
Posted on    November-17-2015 12:05 AM

 .NET ASP.Net  Angular JS 
Ratings:


 1 Reply(s)
 384  View(s)
Rate this:
I want to bind Dropdownlist Value and Text using Angularjs . How to do this.


aditya kumar Patel

Total Post:247

Points:1759
Posted on    November-17-2015 12:11 AM



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AngularList.aspx.cs" Inherits="Forumasp.AngularList" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" ng-app="UserApp">

<head runat="server">

    <title></title>

    <script src="Scripts/jquery-2.1.4.js"></script>

    <script src="Scripts/angular.min.js"></script>

    <script type="text/javascript">

        var app = angular.module('UserApp', []);

        app.controller("CntrUser", ['$scope', function ($scope) {

            $scope.items = [

                    { UserID: "PA011", UserName: "Pawan Shukla" },

                    { UserID: "SU210", UserName: "Suresh Kumar” },

  { UserID: "MA320", UserName: "Manoj Kumar" }

            ];

        }]);

    </script>

</head>

<body>

    <div ng-controller="CntrUser"> 

<br />

        <label>Select User:

   <select>

<option data-ng-repeat="t in items" value="{{t.UserID}}">{{t.UserName}}</option>

</select>

  </label><br/>

    </div>

</body>

</html>

 


Don't want to miss updates? Please click the below button!

Follow MindStick