This is a migrated thread and some comments may be shown as answers.

Drowdownlist ngmodel doesn't set after get ajax data

1 Answer 62 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
crasit
Top achievements
Rank 1
crasit asked on 17 Oct 2017, 02:32 PM

Hi,

I have a problem in dropdownlist angularjs

how to set dropdownlist ng-model after get ajax data

Sample my codes: http://dojo.telerik.com/@muratoner/icoBuB

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 18 Oct 2017, 08:53 AM
Hello Emre,

On the following Dojo example you can find a modified version of the code, where a default item is being selected in the DropDownList on load.

The currently provided Dojo example will work if we pass the id of the selected item (e.g $scope.model = 1) and the respective item will be selected on load. On the other hand, trying to set an object (e.g $scope.model = { ProductID : 1}) will not work, as ng-model binds the field contents and for the DropDownList, you get an integer instead of a JavaScript object. Using an object binding can be achieved by using k-ng-model as shown in the modified Dojo example above.

More useful information can be found in the links below:


Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownList
Asked by
crasit
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or