角度选择不从API调用更新

时间:2016-01-25 21:38:56

标签: javascript angularjs jquery-chosen

我正在使用角度chosen填充选择框:

<select ng-change="checkSelection()" 
        chosen="" 
        class="form-control chosen-select input-md" 
        data-placeholder="Select a Thing" 
        ng-model="theThing" 
        ng-options="thing.name for thing in things"></select>

当我对Controller中的事物列表进行硬编码时,这确实有效,但是当我在http调用的成功函数中设置things(成功)时,不会填充该框:

     $scope.getThings = function() {
        $http.get('/rest/Things', {}).
            success(function(data, status, headers, config) {
               $scope.things = data;
            }).
            error(function(data, status, headers, config) {
                console.log("Could not get list of things " + data);
            });
    }

不起作用。如何让select更新?

0 个答案:

没有答案