car.html
<body ng-app="carService" ng-controller="selectDropdown">
<div>
Car Brand:
<select ng-model="userSelect">
<option value="">--Select--</option>
<option ng-repeat="ManufactureBrand in a" ng-bind="ManufactureBrand"
</option>
</select>
<input type="button" value="submit" ng-click="checkselection()">
<span color:red>{{msg}}</span>
</div>
</body>
detail.js
var app=angular.module('carService',[]);
app.factory('Brandtest',function(){
var brand={};
brand.sample=['Bmw','Mercedes','Honda'];
return brand;
});
app.controller('selectDropdown',['$scope','Brandtest',function($scope,Brandtest){
$scope.a=Brandtest.sample;
$scope.checkselection= function(){
if($scope.userSelect !="" && $scope.userSelect !=undefined){
$scope.msg = $scope.userSelect;
}
}
}]);
Hi, Im trying angularjs newly and Im having problem in displaying the selected item from a dropdown.Please help how to display the selected item from the drop-down box. Thanks in advance.