File

src/app/ui/models/base.component.ts

Description

Abstract class inherited from UI components.

Implements

OnInit OnDestroy

Index

Properties
Methods

Properties

subscriptions
subscriptions: Subscription[]
Type : Subscription[]
Default value : []

Methods

ngOnDestroy
ngOnDestroy()
Returns : void
Abstract ngOnInit
ngOnInit()
Returns : void
Abstract receiveActions
receiveActions()

Subscribes to the actions sent by other components.

Returns : void
Abstract sendActions
sendActions()

Subscribes to the actions sent to other components.

Returns : void
Abstract valueChanges
valueChanges()

Subscribes to the form changes.

Returns : void
import { OnInit, OnDestroy } from "@angular/core";
import { Subscription } from "rxjs";

/**
 * Abstract class inherited from UI components.
 */
export abstract class BaseComponent implements OnInit, OnDestroy {

    subscriptions: Subscription[] = [];

    abstract ngOnInit(): void;

    ngOnDestroy(): void {
        this.subscriptions.forEach((subscription: Subscription) => {
            if (subscription) { subscription.unsubscribe(); }
        });
    }

    /**
     * Subscribes to the form changes.
     */
    abstract valueChanges(): void;

    /**
     * Subscribes to the actions sent by other components.
     */
    abstract receiveActions(): void;

    /**
     * Subscribes to the actions sent to other components.
     */
    abstract sendActions(): void;

}

result-matching ""

    No results matching ""