Created
December 12, 2019 20:47
-
-
Save NeuralGlue/8f7c0c166da1d5984efafe305a7b2913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MyObjectDatasourceService implements DataSource<MyObject> { | |
private myObjectSubject = new BehaviorSubject<MyObject[]>([]); | |
constructor(private myObjectService: MyObjectService){} | |
connect(collectionViewer: CollectionViewer): Observable<MyObject[]> { | |
return this.myObjectSubject.asObservable(); | |
} | |
disconnect(collectionViewer: CollectionViewer): void { | |
this.myObjectSubject.complete(); | |
} | |
loadVentures() { | |
this.myObjectService.fetchRemoteObjects() | |
.pipe( | |
catchError(() => of([])) | |
) | |
.subscribe ( myObjects => { | |
this.myobjectSubject.next(myObjects); | |
} | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment