Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I am new in angularJS,and i have a small question i.e.,regarding dropdown in angularJS

once the user select a textfield from dropdown i am storing valuefield..

but when i want to display the selected textfield in gridview it is displaying only valuefield..how can i overcome it & i have searched on google but might be i did not find the correct resources..


can anyone suggest some good resource for getting all controls details like
dropdown,listbox etc.., in angularJS

And one more Question:Does angularJS fullfill all requirments for developing a non SPA application.

Thanks in advance.
Posted
Updated 19-Mar-21 2:51am
Comments
Anil Vaghasiya 8-Jul-15 2:45am    
Hello,

Can You give brief description with sample code for getting more details and which kind of issue is occur in your case.
--AV

I would say this is your solution:
https://angular-ui.github.io/bootstrap/[^]
 
Share this answer
 
Use ng-options for displaying dropdown
 
Share this answer
 
HTML
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<div ng-app="test">
    <div ng-controller="DemoCtrl">
        <select ng-model="selectedRole" ng-options="Role as Role.Name for Role in Roles track by Role.Id" ng-change="GetValue()">
                                        @*ng-options="Role as Role.Name for Role in Roles"*@
                                        @*ng-options="a.Id as a.Name for a in Roles track by a.Id"*@
            <option value="">Select Account</option>
        </select>
        <br />
        @*selected Value is : {{selectedRole}}*@
    </div>
</div>
<script>
    angular.module('test', []).controller('DemoCtrl', function ($scope, $http, $window) {
        $scope.selectedRole = null;
        $scope.Roles = [];
        $scope.GetValue = function () {
            var RoleId = $scope.selectedRole.Id;
            var RoleName = $scope.selectedRole.Name;
            console.log(RoleId, RoleName);
        }
        $http({
            method: 'GET',
            url: '/Account/GetRoles',
            //data: { applicationId: 3 }
        }).success(function (result) {
            $scope.Roles = result;
            console.log($scope.Roles);
        });
    });
</script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900