angular - How to extract type out of observable<type> in typescript -


i trying create utility class have common functions used among components. below code

import { component, oninit }  'angular2/core'; import { commonservice } './services/common.service'; import { observable }  'rxjs/observable';  @component({     providers: [commonservice] })  export class utils {      constructor(private _commonservice: commonservice) { }      getcolumnnames(database: string, tablename: string): string[] {         return this._commonservice.getcolumnnames(database, tablename).subscribe(data => this.promise(data));     }      private promise(data: string[]) {         return data;     } } 

the common service return observable<string[]> , want extract string[] out of observable<string[]>. know can create private promise retrieve how send calling function in components.


Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -