I have a list of drop down.on click of button i am call one function.In this i need all the values which I selected how i can do this
The following is my code
HTML
<html ng-app="myapp">
<head>
<script src="angular/angular.js"></script>
</head>
<body>
<div ng-app ng-controller="MyCtrl">
<select class="form-control" ng-model="firstType" ng-change="onRegionChange(firstType)" ng-options="item.id as item.name for item in items">
</select>
<input type="submit" ng-click='resultView()'/>
</div>
</body>
</html>
script
<script>
var myapp = angular.module('myapp', []);
myapp.controller('MyCtrl', function ($scope,$http)
{
$scope.Data = {};
$scope.items = [{id:1, name:'First'}, {id:2, name:'Second'}, {id:3, name:'Third'}];
$scope.onRegionChange = function(firstType)
{
console.log(firstType);
}
$scope.resultView = function()
{
console.log(firstType);
}
});
</script>
Any advice or help is much appreciated.
while clicking the button its showing error in console
Thank you this is the error screen shot
$scope.resultView = function(firstType)
{
console.log(this.firstType);
}
just you have to add 'this.firstType' then its working after a long day I found out this
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments