如何使用AngularJS从搜索中选择绑定数据?

时间:2015-09-08 16:19:16

标签: javascript html angularjs

一旦用户完成搜索,我在其中一个字段上有搜索功能,并从数据网格中选择了值我将值填入字段,所以我正在控制台中正确打印值console.log($scope.challengesDTO.chlgOwner)但是它没有绑定到它查看模型challengesDTO.chlgOwner

main.html中

<div class="row">
<div class="form-group col-md-12 fieldHeight">
    <label for="chlgOwner" class="col-md-4">Challenge Initiated on behalf of:</label>
    <div class="col-md-8">
        <input type="text" class="form-control" id="chlgOwner" 
            ng-model="challengesDTO.chlgOwner" ng-click="openChallengerSearch()"
            name="chlgOwner"> 
    </div>
</div>

searchCtrl.js

$scope.selectedChallenger = function(workerObj) {
        $scope.challengesDTO.chlgOwner = workerObj.fullName;
        $scope.challengesDTO.chlgKey = workerObj.workerKey;
        console.log($scope.challengesDTO.chlgOwner);
        $scope.viewChallengeWin.close();
    };

0 个答案:

没有答案