Reputation: 997
I have tried doing it in jQuery :
var dropdownlist = $("#Instrument").data("kendoDropDownList");
dropdownlist.select(function(dataItem) {
return dataItem.symbol === "test";
});
Sources:
- http://jsfiddle.net/OnaBai/mRmNJ/
- Change selected value of kendo ui dropdownlist
Is there a way to do this using AngularJS without directly accessing DOM?
Upvotes: 1
Views: 1624
Reputation: 358
Change Dropdown list selected value in Angularjs
live code is :http://jsfiddle.net/RLQhh/992/
controller.js
app.controller('SelectController', function ($scope) {
$scope.data = [
{ "symbol": "GOOG" },
{ "symbol": "AAPL" },
{ "symbol": "HPQ" },
{ "symbol": "CSCO" }
];
$scope.label = '';
$scope.change = function(){
$scope.label =$scope.data[2].symbol;
}
});
HTML code is
<div ng-controller="SelectController">
<Button ng-click="change()" >Button</Button>
<select class="form-control" ng-model="label" ng-change="showTask()" ng-options="d.symbol as d.symbol for d in data" >
<option value="" disabled>Select Task</option>
</select>
</div>
Upvotes: 1