UNPKG

@namefully/ng

Version:
64 lines (63 loc) 1.73 kB
import { ElementRef, AfterViewInit } from '@angular/core'; import { Namefully, Name, JsonName, Parser, Config } from 'namefully'; import { MethodOf } from './namefully-utils'; /** * Represents an Angular-based attribute directive that wraps up namefully's * core functionalities. Remember, if not satisfied, you can always use some of * of the core elements exported from `namefully` instead. * * @usageNotes * ```html * <p [ngxNamefully]="..." * [nfOptions]="..." * [nfMethod]="..." * [nfArgs]="..." * > * </p> * ``` * * @example * - import the module first to your app * - then use it with the following props bindings * // in the AppModule for example: * ```ts * import { NamefullyModule } from '@namefully/ng' * * @NgModule({ * imports: [BrowserModule, NamefullyModule.forRoot(...)], * declarations: [AppComponent], * bootstrap: [AppComponent] * }) * export class AppModule {} * ``` * * // in the html template: * ```html * <span [ngxNamefully]="name" * [nfOptions]="options" * [nfMethod]="method" * [nfArgs]="args" * > * </span> * ``` * * // in the AppComponent.ts * ```ts * class AppComponent { * name = 'Mr Smith John Joe PhD' * options = { orderedBy: 'lastname' } * method = 'shorten' * args = [] * } * ``` * @see https://angular.io/guide/attribute-directives */ export declare class NamefullyDirective implements AfterViewInit { private elRef; raw: string | string[] | Name[] | JsonName | Parser; options?: Partial<Config>; method?: MethodOf<Namefully>; args?: any[]; constructor(elRef: ElementRef<HTMLElement>); ngAfterViewInit(): void; }