Using ChangeDetectorRef in AsyncPipe

Hello,
i’m struggling with AsyncPipe from Angular2.
I would like to perform something like that :

import { Injectable, ChangeDetectorRef } from '@angular/core';
import { AsyncPipe } from '@angular/common';
...

@Injectable()
export class ProfileDataProvider {
	
	public profile: any;

	constructor( ..., public cdr: ChangeDetectorRef) {

		.......

		this.profile = new AsyncPipe(cdr).transform(...);
	}

}

But I don’t know how to built an AsyncPipe in my TS knowing that i’m not in a component but in a custom provider.

Have you got an idea to built a pipe like this ?

Here is an example of Async Pipe

Thank you for your time, but I already know how to use AsyncPipe in templates.
My problem is how to use them in providers ?

1 Like

Pretty sure, that you would not use an async pipe inside of a provider.
The pipes are meant to be used in your templates,

1 Like

Okay, thank you.
I will do without it then.

Do I have to, in any case, create another variable: any and update it each time the subscribe function of my Observable send me a new value ?
I just wanted to put an async value in an alert component.

Let us know if you find a way to do it. I’m facing the same issue. I want to use Async pipe in my component to get convert an object returned by an observable

What does that have to do with change detection?