Drop down with options from JSON formatted values

Select One option from this list, we will display the selected option value.
Selected Student = {{students}} , Selected Mark = {{students.mark}}

<div ng-app="my_app" ng-controller="my_ctrl">
<select ng-model="students" ng-options="x.name for x in details"  >
<span>Selected Student = {{students}}</span> , 
<span>Selected Mark = {{students.mark}}</span>

var app = angular.module('my_app', []);
app.controller('my_ctrl', function($scope, $http) {
 $scope.details=[{"id":"1","name":"John Deo","class":"Four","mark":"75"},
{"id":"2","name":"Max Ruin","class":"Three","mark":"85"},
{"id":"4","name":"Krish Star","class":"Four","mark":"60"},
{"id":"5","name":"John Mike","class":"Four","mark":"60"}]

Using Filter

In above code we have used data from the JSON formatted string. We can add one filter to only show the options matching to a filter.
DEMO: Filtering Options

Dropdown List Box
DEMO: Options from MySQL database DEMO: Options onChange Event DEMO: onChange Event to post selected option to back end script

Post your comments , suggestion , error , requirements etc here

We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer