2017-01-09 13 views
1

退会と退会の違いは何ですか?Angular2 - rxjsはvs disposeを観察しますか?

// app-service.ts 
{Http} from @angular/core; 

export class appService { 
    constructor(private http : Http, fooService : FooService) {} 
    getAll() { 
     // do this 
     this.sub = this.fooService.subscribe(
      () => {}, 
      error => throw new Error(error), 
      () => {} 
     ) 
    } 

    ngOnDestroy() { 
     this.sub.dispose(); 
    } 
} 

答えて

関連する問題