Interview Questions

1. What is the purpose of AsyncPipe in Angular?

The AsyncPipe is used to subscribe to an observable or promise and return the latest value it has emitted. When a new value is emitted, the pipe marks the component that has been checked for changes.

See the following example where a time observable continuously updates the view for every 2 seconds with the current time.



  selector: 'async-observable-pipe',  

  template: `<div><code>observable|async</code>:  

       Time: {{ time | async }}</div>`  


export class AsyncObservablePipeComponent {  

  time = new Observable(observer =>  

    setInterval(() => Date().toString()), 2000)  



By Md Riyazuddin 2 0
Is this helpful? Yes No

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of w3Sniff.

Get Started


Leave a Comment

Check out more interview questions

Based on your skills

MS SQL Server

1433426 1720 18 859


35906 92 0 46


28193 72 1 36