Skip to content

Instantly share code, notes, and snippets.

View UmerIftikhar's full-sized avatar

Umer Iftikhar UmerIftikhar

  • Helsinki, Finland
View GitHub Profile
export class Constants {
public static apiRoot = '/api', // If there is some prefix for all the APIs, then define that in constants.
public static API_VERSIONS = {
Version1: 'version1',
};
public static pageSettings(): PageEvent {
return {
length: 0,
pageIndex: 0,
pageSize: 10,
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { TodoItem, TodoItemCreate, TodoItemUpdate } from './models';
import { Constants } from './constants';
import { BaseService } from './base.service';
@Injectable()
export class TodoService extends BaseService<TodoItem, TodoItemCreate, TodoItemUpdate> {
constructor(private readonly httpClient: HttpClient) {
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import urljoin from 'url-join';
import { catchError } from 'rxjs/operators';
/*
This should be placed in some miscellaneous folder.
*/
export function constructApiVersionQueryParams(inputParams: HttpParams, apiVersion: string): HttpParams {
if (inputParams && inputParams.keys().length > 0) {