Is there a way to wait the response of my Observer before i return the value?
data(): MatTableDataSource<ITableData> {
        var datasource: MatTableDataSource<ITableData> = new MatTableDataSource()
        var ob: Observer<any> = {
            next: (result: any) => {
                const l = this.processData(result)
                datasource = new MatTableDataSource(l)
            },
            error: (err: Error) => {
                console.log(err)
            },
            complete: () => {
            }
        }
        this.getDataFromJson().subscribe(ob);
        console.log(datasource)
        return datasource;
    }
Right now it doesn't return the value attributed in the observer but the new MatTableDataSource() from when i declare it. Because the return executes before my Observer.
Expected Result: datasource.data = Array(15)
Result got: datasource.data = Array(0)
 
    