import { OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { BaseComponent } from '../base/base.component'; /** * This is the abstract create component that can be used in the create views. */ export declare abstract class CreateComponent extends BaseComponent implements OnInit { readonly hasError: boolean; /** * The model, that contains the T object. */ model: T; /** * Error flag. */ private error; constructor(); /** * This method runs before onInit() method. */ ngOnInit(): void; /** * This method starts the createModel() method. Starts the POST request. */ create(): void; /** * This function populates the model with a new Instance. */ protected abstract initModel(): T; /** * This function will post the model to the API. */ protected abstract createModel(): Observable; /** * This method runs, when the create method completed. * @param resp Response from the API. This response will refresh the model. */ private created; /** * Simple error handler. * @param {any} error Error */ private errorHandler; } export interface CreateComponent { /** * This function runs after the model is created, and got a successful response from the api. */ afterCreated?(): void; /** * This optional function runs before the private createModel() function runs. */ beforeCreate?(): void; }