8. Test the Component logic using a mocked up Service
export interface Name { name: string; }
ng g service appimport { Injectable } from '@angular/core';
import { of, Observable } from 'rxjs';
import { Name } from './app.models';
@Injectable({
providedIn: 'root'
})
export class AppService {
constructor() {}
getCompanies(): Observable<Name[]> {
return of([
{ name: 'Duncan' },
{ name: 'Sarah' }
]);
}
}
Last updated