javascript - Combo box filled from json response does not behave normally -
i have javascript code:
(function() { var app = angular.module("fhu", []); app.controller("fhucontroller", function(){ this.carlist = cars; }); $(document).ready(function(){ var car = {}; $.getjson("fillingapi.php?action=get_cars",function(data){ var i=0; for(i=0;i<data.length;i++){ cars.push( {license: data[i].license, descr: data[i].descr}); } }); }); var cars=[]; })();
it seems work. array correctly filled json response. problem showing combo box. in html file have this:
<select ng-model="selectedcar" ng-options="x.license x in fhu.carlist"> </select> <h1>you selected: {{selectedcar.license}}</h1> <p>it is: {{selectedcar.descr}}</p>
this works... after random clicking outside combo box. combo not contain , narrow. after clicking outside combo, enlargen normal width , start work normally. when had first array filled in code manually, combo behaving fine. what's difference? why combo not refreshed correctly @ page load?
Comments
Post a Comment