Angular

Debug observable in Angular

Async pipe will automatically subscribe to observable. And json pipe will output all the data in json format.
html:

[pre]
{{ data$ | async | json }}
[/pre]

Resolve observable in Angular

<div *ngIf="user$ | async as user; else userEmpty">
  {{ user.email }}
  {{ user.name }}
</div>
 
<ng-template #userEmpty>
  <div>
    User is empty
  </div>
</ng-template>

StackBlitz + Github + Angular

For example you have any github repo with Angular in it
https://github.com/angular-university/rxjs-course/
You can execute this repo by accessing it via stackblitz like this:
https://stackblitz.com/github/angular-university/rxjs-course/
It gives you file browser. All your changes reflect automatically.
This trick works with branches and commits too:
https://stackblitz.com/github/{GH_USERNAME}/{REPO_NAME}/tree/{TAG|BRANCH|COMMIT}

  • https://stackblitz.com/github/{GH_USERNAME}/{REPO_NAME}
  • https://stackblitz.com/github/{GH_USERNAME}/{REPO_NAME}/tree/{TAG|BRANCH|COMMIT}
  • https://stackblitz.com/github/angular-university/rxjs-course/tree/1-operators

Links:

Leave a Reply

Your email address will not be published. Required fields are marked *