File

projects/ng-dynamic-forms/ui-primeng/src/lib/chips/dynamic-primeng-chips.component.ts

Extends

DynamicPrimeNGFormControlWithTemplateComponent

Metadata

selector dynamic-primeng-chips
templateUrl ./dynamic-primeng-chips.component.html

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(layoutService: DynamicFormLayoutService, validationService: DynamicFormValidationService)
Parameters :
Name Type Optional
layoutService DynamicFormLayoutService No
validationService DynamicFormValidationService No

Inputs

formLayout
Type : DynamicFormLayout
group
Type : FormGroup
layout
Type : DynamicFormControlLayout
model
Type : DynamicInputModel
templates
Type : QueryList<DynamicTemplateDirective> | DynamicTemplateDirective[] | undefined

Outputs

blur
Type : EventEmitter<any>
change
Type : EventEmitter<any>
customEvent
Type : EventEmitter<DynamicFormControlCustomEvent>
focus
Type : EventEmitter<any>

Methods

mapTemplate
mapTemplate(template: DynamicTemplateDirective)
Parameters :
Name Type Optional
template DynamicTemplateDirective No
Returns : DynamicTemplateDirective | TemplateRef
bindTemplate
bindTemplate(template: DynamicTemplateDirective)
Parameters :
Name Type Optional
template DynamicTemplateDirective No
Returns : void
Abstract mapTemplate
mapTemplate(template: DynamicTemplateDirective)
Parameters :
Name Type Optional
template DynamicTemplateDirective No
Returns : DynamicTemplateDirective | TemplateRef
ngAfterViewInit
ngAfterViewInit()
Returns : void
getClass
getClass(context: DynamicFormControlLayoutContext, place: DynamicFormControlLayoutPlace, model: DynamicFormControlModel)
Parameters :
Name Type Optional Default value
context DynamicFormControlLayoutContext No
place DynamicFormControlLayoutPlace No
model DynamicFormControlModel No this.model
Returns : string
onBlur
onBlur($event: any)
Parameters :
Name Type Optional
$event any No
Returns : void
onChange
onChange($event: any)
Parameters :
Name Type Optional
$event any No
Returns : void
onCustomEvent
onCustomEvent($event: any, type: string | null, bypass: boolean)
Parameters :
Name Type Optional Default value
$event any No
type string | null No null
bypass boolean No false
Returns : void
onFocus
onFocus($event: any)
Parameters :
Name Type Optional
$event any No
Returns : void

Properties

pChips
Type : Chips
Decorators :
@ViewChild('pChips', {static: true})
Readonly templateDirectives
Default value : PRIME_NG_TEMPLATE_DIRECTIVES
Readonly templateDirectives
Type : Map<string | string>
templates
Type : QueryList<DynamicTemplateDirective> | DynamicTemplateDirective[] | undefined
Private _hasFocus
Default value : false
blur
Type : EventEmitter<any>
change
Type : EventEmitter<any>
customEvent
Type : EventEmitter<DynamicFormControlCustomEvent>
focus
Type : EventEmitter<any>
formLayout
Type : DynamicFormLayout
group
Type : FormGroup
layout
Type : DynamicFormControlLayout
model
Type : DynamicFormControlModel
templates
Type : DynamicFormControlTemplates

Accessors

viewChild
getviewChild()
import { Component, EventEmitter, Input, Output, QueryList, ViewChild } from "@angular/core";
import { FormGroup } from "@angular/forms";
import { Chips } from "primeng/primeng";
import {
    DynamicFormControlCustomEvent, DynamicFormControlLayout,
    DynamicFormLayout,
    DynamicFormLayoutService,
    DynamicFormValidationService,
    DynamicInputModel,
    DynamicTemplateDirective
} from "@ng-dynamic-forms/core";
import { PRIME_NG_TEMPLATE_DIRECTIVES } from "../dynamic-primeng-form.const";
import { DynamicPrimeNGFormControlWithTemplateComponent } from "../dynamic-primeng-form-control-with-template.component";

@Component({
    selector: "dynamic-primeng-chips",
    templateUrl: "./dynamic-primeng-chips.component.html"
})
export class DynamicPrimeNGChipsComponent extends DynamicPrimeNGFormControlWithTemplateComponent {

    readonly templateDirectives = PRIME_NG_TEMPLATE_DIRECTIVES;

    @Input() formLayout: DynamicFormLayout;
    @Input() group: FormGroup;
    @Input() layout: DynamicFormControlLayout;
    @Input() model: DynamicInputModel;
    @Input() templates: QueryList<DynamicTemplateDirective> | DynamicTemplateDirective[] | undefined;

    @Output() blur: EventEmitter<any> = new EventEmitter();
    @Output() change: EventEmitter<any> = new EventEmitter();
    @Output() customEvent: EventEmitter<DynamicFormControlCustomEvent> = new EventEmitter();
    @Output() focus: EventEmitter<any> = new EventEmitter();

    @ViewChild("pChips", { static: true }) pChips: Chips;

    constructor(protected layoutService: DynamicFormLayoutService,
                protected validationService: DynamicFormValidationService) {

        super(layoutService, validationService);
    }

    get viewChild(): Chips {
        return this.pChips;
    }
}
<div [formGroup]="group" [ngClass]="getClass('grid', 'control')">

    <p-chips #pChips
             [allowDuplicate]="model.getAdditional('allowDuplicate', true)"
             [formControlName]="model.id"
             [id]="id"
             [ngClass]="getClass('element', 'control')"
             [tabindex]="model.tabIndex"
             (change)="onChange($event)"
             (onAdd)="onCustomEvent($event, 'onAdd')"
             (onRemove)="onCustomEvent($event, 'onRemove')"></p-chips>

</div>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""