Javascript AngularJS范围值未定义,但API工作正常

Javascript AngularJS范围值未定义,但API工作正常,javascript,angularjs,Javascript,Angularjs,我没有收到任何错误消息,但在调试作用域值未绑定时,它显示未定义… 控制器: $scope.companyModify = function () { var param = { companyId:$scope.companyId, companyName:$scope.companyName, billPrintLinesTop:$scope.billPrintLinesTop, billPrintLinesBottom:

我没有收到任何错误消息,但在调试作用域值未绑定时,它显示未定义…

控制器:

$scope.companyModify = function () {
    var param = {
        companyId:$scope.companyId,
        companyName:$scope.companyName,
        billPrintLinesTop:$scope.billPrintLinesTop,
        billPrintLinesBottom:$scope.billPrintLinesBottom,
        isPrintHeader:$scope.isprintHeader,
        billTypeId:$scope.billTypeId,
        billColumnId :$scope.billColumnId,
        noOfCopies: $scope.noOfCopies,
        billHeaderAlignmentId: $scope.billHeaderAlignmentId,
        billTitle: $scope.billTitle,
        billSortOrderId:$scope.billSortOrderId,
        posDefaultQty:$scope.posDefaultQty,
        posTaxTypeId:$scope.posTaxTypeId,
        isAllowNegativeStock:$scope.isAllowNegativeStock,
        serviceTaxCalcTypeId : $scope.serviceTaxCalcTypeId,
        wishMessage:$scope.wishMessage,
        coinageBy:$scope.coinageBy,
        isAutoGenerateProductCode:$scope.isAutoGenerateProductCode
    };

    console.log(param);
调用companyModify函数: 打开companyModify的大括号在SocketService中关闭

   SocketService.post(apiManage.apiList['CompanyModify'].api,param).
     then(function (resp) {
       var data = resp.data.response;

       if (data.status === true) {
            angular.forEach($scope.companyList, function (value) {
                 if (value.companyId == $scope.companyId) {
                    value.$edit = false;
                 }
        });

            Notify.alert(data.message, {
                status: 'success',
                pos: 'top-right',
                timeout: 5000
            });
            $scope.load();

        }
        else {
            Notify.alert(data.message, {
                status: 'danger',
                pos: 'top-right',
                timeout: 5000
            });
        }
    });
};

确保在控制器中正确注入$scope

someModule.controller('MyController', ['$scope', function($scope) {
  ...
  $scope.aMethod = function() {
  ...
  }
  ...
}]);
在html代码中,输入值绑定到
company.XXX

<input type="text" class="form-control input-sm" ng-model="company.posTaxTypeId" placeholder="Enter POSTaxCalculation"  >
还要确保绑定声明正确,没有空格:

坏的

data-ng-bind="company.posTaxTypeId "
ng-model="company.posTaxTypeId "
data-ng-bind="company.posTaxTypeId"
ng-model="company.posTaxTypeId"

data-ng-bind="company.posTaxTypeId "
ng-model="company.posTaxTypeId "
data-ng-bind="company.posTaxTypeId"
ng-model="company.posTaxTypeId"

你能补充更多的细节吗?你能不能提供你的代码,这将帮助我们找到根本原因我认为您必须返回参数@Sridhar仍然会出现相同的错误先生..@Pramod_Para先生我是新来的angular我不知道如何使用plunker..@KumareshRoy请提供您控制器的完整代码这里是完整代码的链接先生。。plnkr.co/edit/kosolblfsjcuhcawvjsh在html代码中ng模型属性和占位符属性之间没有空格,能否修复此问题并再次检查
ng model=“company.companyName”占位符
@KumareshRoy请在应用更改后提供代码的更新版本。也许你忘了什么。你没有应用我告诉你的更改。在html代码中,仍然有大量的
ng model=“company.xxx”
而不是
ng model=“xxx”
。请记住,您的
param
对象值仍然指向
scope
属性,而不是
scope.company
属性。例如:
ng model=company.billPrintLinesTop
在html代码中绑定,但
参数:{billPrintLinesBottom:$scope.billPrintLinesBottom}
在控制器中使用