ali ramezani

ali ramezani

  • NA
  • 16
  • 576

Don't Fill Data to dropdown list in angularjs!

Nov 1 2017 6:02 PM
I write this code, but not work!!
please help me.
 
 
Controller:
(function () {
appModule.controller('education.views.students.createOrEditModal', [
'$scope', '$window','$uibModalInstance', 'abp.services.app.student', 'studentId', 'abp.services.app.city', 'uiGridConstants',
function ($scope, $window, $uibModalInstance, studentService, studentId, cityService, uiGridConstants) {
var vm = this;
vm.saving = false;
vm.student = null;
vm.selectedCity = null;
vm.Cities = [];
vm.GetValue = function () {
var CityId = vm.selectedCity.Id;
var CityName = vm.selectedCity.Name;
//console.log(CityId, CityName);
cityService.getCities({
}).then(function (result) {
vm.Cities = result.data;
//console.log(vm.Cities);
});
};
cshtml:
<div ng-app="appModule">
<div ng-controller="education.views.students.createOrEditModal">
<select ng-model="selectedCity" ng-options="City as City.name for City in vm.Cities track by City.Id" ng-change="vm.GetValue()">
<option value="">Select City</option>
</select>
<br />
@*selected Value is : {{selectedCity}}*@
</div>
</div>

Attachment: Problem_Code.zip

Answers (1)