Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Zim_Ejin zimejin

Block or report user

Report or block zimejin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View user-async.component.ts
import { Component, OnInit } from '@angular/core';
import { UserAsyncService } from './user-async.service';
import { Observable } from 'rxjs';
@Component({
selector: 'app-user-async',
templateUrl: './user-async.component.html',
styleUrls: ['./user-async.component.scss'],
providers: [UserAsyncService]
})
View googleData.ts
export interface GoogleData {
id: number;
country: string;
zipCode: string;
}
View user.component.spec.ts
import { async, TestBed } from '@angular/core/testing';
import { UserComponent } from './user.component';
import { UserService } from './user.service';
describe('UserComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [UserComponent]
View user-async.service.ts
import { Observable, Observer } from 'rxjs';
export class UserAsyncService {
user = { name: 'Mannie' };
getUserDetails() {
// Create an observables.
const userObservables = Observable.create(
(observer: Observer<{ name: string }>) => {
setTimeout(() => {
observer.next(this.user);
View user-async.component.spec.ts
import { TestBed, tick, fakeAsync } from '@angular/core/testing';
import { UserAsyncComponent } from './user-async.component';
import { UserAsyncService } from './user-async.service';
import { Observable, Observer } from 'rxjs';
describe('User Async Component:', () => {
beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [UserAsyncComponent]
});
You can’t perform that action at this time.