你应该让search
方法返回Observable对象.像这样的东西:
dataService.search = function(searchExp) { var promise = new Promise((resolve, reject) => { this.getAccessToken() .then(accesstoken => { return this.http.get('data.json') .map(response => response.json()) .subscribe(data => resolve(data), err => reject(err)) }) }); return PromiseObservable.create(promise); // Observable.fromPromise(promise) };