如何在Angular 2中使用羽毛 - 客户端和superagent?

时间:2017-02-13 14:03:56

标签: angular typescript superagent feathersjs

import { Injectable } from '@angular/core';
import * as feathers from 'feathers-client';
import * as superagent from 'superagent';
// const superagent = require('superagent');
// const feathers = require('feathers/client');
// const rest = require('feathers-rest/client');
// import * as rest from 'feathers-rest/client';

const HOST = 'http://localhost:3030'; // Your base server URL here
const rest = feathers.rest(HOST);

@Injectable()
export class ApiService {
  private _app: any;
  constructor() {
    this._app = feathers() // Initialize feathers
      .configure(rest.superagent(superagent)); // Fire up rest
  }

  public test() {
      console.log('pepowopeoepeepw');
  }

}

我尝试过很多东西,但一直都是错误

  1. src / client / app / services / api-service.ts(11,23):错误TS2339:属性'休息'在' typeof"
  2. 类型中不存在
  3. src / client / app / services / api-service.ts(18,17):错误TS2349:无法调用类型缺少调用签名的表达式。
  4. node_modules / feathers-client / index.d.ts(25,3):错误TS7010:' on',缺少返回类型注释,隐含有' any& #39;返回类型。
  5. 不确定是什么问题?

0 个答案:

没有答案