Here I have select box,onchange of dropdown I need to add dynamic id on div based on the value of selected option of dropdown .I have mentioned in alert what id to be add onchange.Here is the code below
html
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<select class="change" ng-model="x" ng-change="update()">
<option value="city">Cities</option>
<option value="state">States</option>
<option value="country">Countries</option>
</select>
<div id=""></div>
script
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.update = function() {
if($scope.x == 'city'){
alert('add id as city1 inside ablove div');
}
if($scope.x == 'state'){
alert('add id as mystate inside ablove div');
}
if($scope.x == 'country'){
alert('add id as mycountry inside ablove div');
}
}
});
vlaueinstead ofvalue