TypeError: Cannot read property 'then' of undefined

后端 未结 2 1284
长情又很酷
长情又很酷 2020-11-29 02:53
loginService.islogged() 

Above function return a string like \"failed\". However, when I try to run then function on it, it will return error of

2条回答
  •  情深已故
    2020-11-29 03:15

    TypeError: Cannot read property 'then' of undefined when calling a Django service using AngularJS.

    If you are calling a Python service, the code will look like below:

    this.updateTalentSupplier=function(supplierObj){
      var promise = $http({
        method: 'POST',
          url: bbConfig.BWS+'updateTalentSupplier/',
          data:supplierObj,
          withCredentials: false,
          contentType:'application/json',
          dataType:'json'
        });
        return promise; //Promise is returned 
    }
    

    We are using MongoDB as the database(I know it doesn't matter. But if someone is searching with MongoDB + Python (Django) + AngularJS the result should come.

提交回复
热议问题