Edit: It looks like my main problem now is that I can\'t seem to display async data from an object. I have a promise containing the data object, and when I use
The OP asked for promises but in case people are using Observables, adapting @user2884505's answer, since pluck isn't directly available on observables as a method in recent versions of RxJS, you may have something like this :
import { Pipe, PipeTransform } from '@angular/core';
import { Observable } from 'rxjs';
import { pluck } from 'rxjs/operators';
@Pipe({
name: 'asyncKey',
pure: false
})
export class AsyncKeyPipe implements PipeTransform {
private observable: Observable
And then, you can use it, even for nested keys :
{{ user$ | asyncKey: 'address' : 'street' }}