2

私はバックエンドでapp-engineを使用しています。Google Cloud Endpointsでフロントエンド用のAPIを公開しています。フロントエンドはAngular2を使用しています。Google Cloud Endpoint with Angular2

私は戦略がjavascriptのためのhere(またはAngular1用here)を説明し、このほとんど動作しますが、ベースの観察可能ではないと現時点でAngular2とうまく調和しない、などのサービスに包まれていない続いています

「DefinitelyTyped」では、Google Sign-In APIのタイプ定義はtheseでしたが、認証のみに使用されています。

私はGapiのラッパーサービスを作成することになりますが、誰かがより良いアプローチをしているかもしれません。

+0

の可能な重複(http://stackoverflow.com/questions/ 34755350/using-http-rest-apis-with-angular-2) –

+0

ブレント、あなたがリンクしている質問はHttpです。私の質問は、特にGoogle Cloud Endpointについてです。 – Julien

+0

私の間違い、私はAngular2についてだと思った。私は近い投票を取り下げた。よりよいアプローチの広い質問の代わりに、特定の質問についてもう少し詳細を追加することをお勧めします。 –

答えて

0

プロミスはどうですか? [HTTPは角度2とAPIを休ま使用]

maybe.service.ts

function getPerson: Promise<FooBarResponse>(){ 
    var arg:ArgFooBarPeople = new ArgFooBarPeople(); 
    return new Promise<FooBarResponse>(
      (resolve,reject) => 
      { gapi.client["foobarapi"]["person"].all(arg).execute(
        (response:any)=>{ 
         resolve(response); 
        }); 
      } 
     ); 
} 

maybe.component.ts

function load(){ 
    this._foobarService.getPerson()then(
      (response:FooBarResponse):void =>{ 
        console.log(response); 
        this.fooBarResponse = response; 
     }).catch((error)=>{this.error="error !!"}); 
} 
関連する問題