Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorials</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"> </script> </head> <body> <div ng-app="myApp" ng-controller="selectCtrl"> <h3>Selectbox using ng-repeat in AngularJS</h3> <select> <option ng-repeat="x in technology" required>{{x}}</option> </select> <h3>Selectbox using ng-options in AngularJS</h3> <select ng-model="name" ng-change="changefun()" ng-options="x for x in technology"></select> <tt>{{mychange}}</tt> <h3>Selectbox using Multiple select in AngularJS</h3> <select name="multipleSelect" id="multipleSelect" ng-model="data.multipleSelect" multiple> <option ng-repeat="x in technology">{{x}}</option> </select><br> <tt>multipleSelect = {{data.multipleSelect}}</tt><br/> </div> <script> var app = angular.module("myApp", []); app.controller("selectCtrl", function($scope) { $scope.technology = [ "HTML", "AngularJS", "CSS", "C", "JAVA", "PHP", ] $scope.changefun=function(){ $scope.mychange="Option changed"; }; }); $scope.data = { multipleSelect: [] }; </script> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.