1
我想在控制器中獲得$ scope.selectedBranch,但它沒有更新。如果我在HTML中使用$ scope.selectedBranch,它工作正常。角度選擇模型在控制器中不更新
<select ng-model="selectedBranch" ng-change="onBranchChange()" ng-options="branch for branch in data.branches"
所有
$scope.onBranchChange= function(){
console.log($scope.selectedBranch)
};
data = {"branches" : ["343dfds","dfdf43","sdfsd","sadser343"]}
感謝阿米特....但它不是問題...我只是忘了在這裏添加數據之前$範圍....在實際只是它的代碼$ scope.data 。 –
然後代碼在我的機器上正常工作。你可以創建或plunkr或somehing? – Amit