Forms Angular 2和Firebase在表单提交时抛出TableReference异常

Forms Angular 2和Firebase在表单提交时抛出TableReference异常,forms,angular,firebase,Forms,Angular,Firebase,你能帮我解决这个问题吗 ERROR in /src/app/services/firebase.service.ts (33,12): Type 'ThenableReference' is not assignable to type 'Promise<any>'. Property '[Symbol.toStringTag]' is missing in type 'ThenableReference'.) webpack: Failed to compile. 让您的a

你能帮我解决这个问题吗

ERROR in /src/app/services/firebase.service.ts (33,12): Type 'ThenableReference' is not assignable to type 'Promise<any>'.
  Property '[Symbol.toStringTag]' is missing in type 'ThenableReference'.)

webpack: Failed to compile.
  • 让您的
    addBusiness
    方法返回
    firebase。然后使用table
    而不是Promise
  • 创建一个
    Promise
    对象

    addBusiness(newBusiness): Promise<any>{
       return new Promise(function(resolve, reject){
           this.businesses.push(newBusiness)
              .then(x=>resolve(x), x=>reject(x));
       });
    }
    
    addBusiness(新业务):承诺{
    返回新承诺(功能(解决、拒绝){
    这个.业务.推送(新业务)
    。然后(x=>解析(x),x=>拒绝(x));
    });
    }
    
  • 让您的
    addBusiness
    方法返回
    firebase。然后使用table
    而不是Promise
  • 创建一个
    Promise
    对象

    addBusiness(newBusiness): Promise<any>{
       return new Promise(function(resolve, reject){
           this.businesses.push(newBusiness)
              .then(x=>resolve(x), x=>reject(x));
       });
    }
    
    addBusiness(新业务):承诺{
    返回新承诺(功能(解决、拒绝){
    这个.业务.推送(新业务)
    。然后(x=>解析(x),x=>拒绝(x));
    });
    }
    

  • 嘿,你解决了这个问题吗?我也有同样的问题?嘿,你解决了吗?我也有同样的问题?
    addBusiness(newBusiness): Promise<any>{
       return new Promise(function(resolve, reject){
           this.businesses.push(newBusiness)
              .then(x=>resolve(x), x=>reject(x));
       });
    }