Angularjs 无法使用angular UI Grid通过$scope设置文本框值

Angularjs 无法使用angular UI Grid通过$scope设置文本框值,angularjs,model-view-controller,angular-ui-grid,Angularjs,Model View Controller,Angular Ui Grid,任何关于如何通过作用域、ir或任何方法设置文本框值的想法,我想要的是当用户单击行按钮时,我想通过从特定行获取数据来填充字段……在UI网格Angularjs中,请尝试如下所示 $scope.get = function (row) { alert(row.entity.OFFICE_ID); var promiseGetSingle = OfficeService.get(row.entity.OFFICE_ID); promiseGetSingle.then(funct

任何关于如何通过作用域、ir或任何方法设置文本框值的想法,我想要的是当用户单击行按钮时,我想通过从特定行获取数据来填充字段……在UI网格Angularjs中,请尝试如下所示

 $scope.get = function (row) {
    alert(row.entity.OFFICE_ID);
    var promiseGetSingle = OfficeService.get(row.entity.OFFICE_ID);
    promiseGetSingle.then(function (pl) {
        var res = pl.data;
        alert(res.Name);
        $scope.OFFICE_ID = res.OFFICE_ID;
        $scope.Org_ID = res.Org_ID;
        $scope.Name = res.Name;
        $scope.IsNewRecord = 0;
    },
              function (errorPl) {
                  console.log('failure loading Organization', errorPl);
              });
}

请按如下所示进行尝试

 $scope.get = function (row) {
    alert(row.entity.OFFICE_ID);
    var promiseGetSingle = OfficeService.get(row.entity.OFFICE_ID);
    promiseGetSingle.then(function (pl) {
        var res = pl.data;
        alert(res.Name);
        $scope.OFFICE_ID = res.OFFICE_ID;
        $scope.Org_ID = res.Org_ID;
        $scope.Name = res.Name;
        $scope.IsNewRecord = 0;
    },
              function (errorPl) {
                  console.log('failure loading Organization', errorPl);
              });
}
 $scope.get = function (row) {
    alert(row.entity.OFFICE_ID);
    var promiseGetSingle = OfficeService.get(row.entity.OFFICE_ID);
    promiseGetSingle.then(function (pl) {
        var res = pl.data;
        alert(res.Name);
        $scope.OFFICE_ID = res.OFFICE_ID;
        $scope.Org_ID = res.Org_ID;
        $scope.Name = res.Name;
        $scope.IsNewRecord = 0;
    },
              function (errorPl) {
                  console.log('failure loading Organization', errorPl);
              });
}
 $scope.Name='';//define the variable globally

 $scope.get = function (row) {
    var promiseGetSingle = OfficeService.get(row.entity.OFFICE_ID);
    promiseGetSingle.then(function (pl) {
        $scope.Name = res.Name;
   },
 }