2013-08-29 60 views

回答

1

您使用不正確的型號名稱。您使用的模型被稱爲selected而不是selectedBrandInput

$scope.onBrandSelect = function ($item, $model, $label) { 
     $scope.state = $item;  //save it somewhere 
     $scope.selected = undefined; //instead of $scope.selectedBrandInput = null; 
     if (!$scope.$$phase) { 
      $scope.$apply(); 
     } 
     console.log($item) 
    } 
-1

我可以找到最好的解決辦法是

$('.typeahead').typeahead('val', myVal); 

使用this reference

您可以通過這種方法$( '預輸入 ')。預輸入(' VAL' 設置爲空字符串 「」 );

這將清空列表。