Skip to content

Instantly share code, notes, and snippets.

View vijayksingh's full-sized avatar
🦊
Junior Developer for Life 🐱‍💻

Vijay Singh vijayksingh

🦊
Junior Developer for Life 🐱‍💻
View GitHub Profile
@vijayksingh
vijayksingh / understand-rxjs-defer.md
Created October 11, 2020 17:52 — forked from ThomasBurleson/understand-rxjs-defer.md
Why is RxJS::defer() important!

Quite simply, because Observables can encapsulate many different types of sources and those sources don't necessarily have to obey that interface. Some like Promises always attempt to eagerly compete.

Consider:

const promise = $.get('https://www.google.com');
import {
Component,
OnInit,
Input,
ViewChild,
ElementRef,
HostBinding
} from '@angular/core';
@Component({
import { Component, OnInit, ChangeDetectionStrategy, Input } from '@angular/core';
import { BaseGraphqlService } from '@otalio/modules';
import { DatePipe } from '@angular/common';
import { MaintenenceRequestsApiService, MaintenenceRequestDto } from '@otalio/api';
import { ServiceItemsTreeStructureService } from '../../services/service-items-tree-structure.service';
import { Observable } from 'rxjs';
import { MenuTreeItem } from '@otalio/components';
import { ServiceRequestsTreeSelected } from '../service-requests-tree/entities/service-requests-tree-selected';
@Component({