我试图在控制器中获取$ 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"]}
答案 0 :(得分:0)
使用数据前缀$ scope。 它应该如下:
$scope.data = {"branches" : ["343dfds","dfdf43","sdfsd","sadser343"]}