@ssv/ngx.command
Version:
Command pattern implementation for angular. Command used to encapsulate information which is needed to perform an action.
30 lines (29 loc) • 1.19 kB
TypeScript
import { OnInit, OnDestroy } from "@angular/core";
import { ICommand, CommandCreator } from "./command.model";
import * as i0 from "@angular/core";
/**
* Command creator ref, directive which allows creating Command in the template
* and associate it to a command (in order to share executions).
* @example
* ### Most common usage
* ```html
* <div #actionCmd="ssvCommandRef" [ssvCommandRef]="{host: this, execute: removeHero$, canExecute: isValid$}">
* <button [ssvCommand]="actionCmd.command" [ssvCommandParams]="hero">
* Remove
* </button>
* <button [ssvCommand]="actionCmd.command" [ssvCommandParams]="hero">
* Remove
* </button>
* </div>
* ```
*
*/
export declare class CommandRefDirective implements OnInit, OnDestroy {
commandCreator: CommandCreator | undefined;
get command(): ICommand;
private _command;
ngOnInit(): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CommandRefDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<CommandRefDirective, "[ssvCommandRef]", ["ssvCommandRef"], { "commandCreator": { "alias": "ssvCommandRef"; "required": false; }; }, {}, never, never, true, never>;
}