I am new to Angularjs. I have tired show & hide div using dropdown select and it is working. But I don't have idea to show the default values.
Requirement : Initial stage I have to display the first option in the dropdown and show the respective div
HTML :
<div ng-app="myApp" ng-controller="MyCtrl">
<select name="name" ng-model="region.name" ng-dropdown required ng-change="changeme()"
<option ng-option value="us" selected="selected">us</option>
<option ng-option value="uk">uk</option>
</select>
<div id="one" ng-if="region.name == 'us'"> US based event</div>
<div id="two" ng-if="region.name == 'uk'"> UK based event</div>
</div>
JS:
var myApp = angular.module('myApp', []);
myApp.controller('MyCtrl', function($scope, $window, $element) {
$scope.changeme = function() {
//no code
}
});
Ref code: jsfiddle