How to get the selected drop down list value on button click without passing the parameters in angularjs

user1187

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 consoleenter image description here

Thank you this is the error screen shot

user1187
$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.

edited at
0

Comments

0 comments
Login to comment

Related

How to save drop down list selected value of Item template in database on button click?

How to create a drop down button without showing the selected value

How to get selected value from drop down list using knockout

How to get the selected value of a drop-down list with JavaScript/JQuery

How to display the selected text value from (select drop-down) without reload the page or using button

Angular 2 - How to disabled button and enable it back until some value is selected in the drop down list?

Get drop down list options based on selected checkbox value

Get selected value from the drop down list with Angular

Get selected value from a drop-down list in Angular

php dependent drop down list get selected value

How to control the view based on the value selected from drop down in AngularJs?

How get selected value from drop-down list (Content control) using VBA in Word

How to get a value, using python, from a selected option in a drop down list in HTML? (FLASK)

How to fix drop down list not passing value in Laravel 5.7

How drop down-list selected value assign to <small>

PowerApps: How to change the selected value of a drop down list via expression

how to set the selected value in the drop down list populated with ViewData in mvc

How to get a selected item in drop-down list?

Get selected value from drop down and pass selected value into submit button in php

How to get value of selected radio button in angularjs

how to get selected value from Drop-down, if drop-down is binded with keys of json

Angular - HTML - pass selected value from drop down to TS method on button click

Get Selected Values from Drop down List

Get Selected Object Of Kendo Drop Down List

How do I use the selected property to selected parameters of an Insert query with drop down list

Get ID of selected value in drop down

Get drop down selected value from row in datatables when trigger button

How to the get the correct value in drop down list during editing in codeiginiter?

.NET How to send value of drop down list item with GET