Angular

Last Updated: 9/7/2023

Common Data Service

  • create services/data.service.ts
export class DataService {
	constructor(private url:string, private http:HttpClient){}
	getAll(){}
	create(resource){}
	update(resource){}
	delete(id){}
}
  • Construct of derived class must make super call
PostService extends DataService {
	constructor(http: Http) {
		super("pass url", http);
	}
}
  • In PostsComponent, update all reference