import { EventEmitter, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { DetailErrorType } from '../../enums'; import { BaseComponent } from '../base/base.component'; export declare abstract class DetailComponent extends BaseComponent implements OnInit { readonly hasError: boolean; /** * The model mostly has id. This can be string or number. */ id: string | number; /** * The model, that contains the T object. */ model: T; /** * Error type. */ errorType: DetailErrorType; /** * Error flag. */ private error; constructor(); ngOnInit(): void; /** * The abstract function, that needs to be implemented in the child element. This method will get the T model from the api. * @returns Observable */ protected abstract getModel(): Observable; /** * This method repopulates the model. This method uses the loading feature, and loads the model from the backend. */ protected refreshModel(withLoading?: boolean): void; /** * This method populates the model and the originalModel. * @param resp Succsessful response from the backend. */ private setModel; /** * Simple error handler. * @param {any} error Error * @param {DetailErrorType} errorType Type of error */ private errorHandler; } export interface DetailComponent { onModelChanged?(): EventEmitter; /** * This function runs after the model is loaded. * * @memberof DetailComponent */ afterModalLoaded?(): void; onError(): void; }