projects/i-components/src/lib/directives/clickactionparameter.directive.ts
Angular Directive for the wmClickActionParameter
Selector | [wmClickActionParameter] |
Properties |
Methods |
Inputs |
constructor(elementRef: ElementRef)
|
||||||
Constructor.
Parameters :
|
model | |
Type : any
|
|
Model of the element using the directive |
wmClickActionParameter | |
Type : string | BindingInfo
|
|
click action parameter property |
ngOnChanges | ||||||||
ngOnChanges(changes: SimpleChanges)
|
||||||||
Angular life-cycle hook
Parameters :
Returns :
void
|
ngOnInit |
ngOnInit()
|
Event Handler for when the ngOninit.
Returns :
void
|
setDependencyValue |
setDependencyValue()
|
Sets the value to the Dependency property
Returns :
void
|
model |
Type : any
|
Decorators :
@Input()
|
Model of the element using the directive |
wmClickActionParameter |
Type : string | BindingInfo
|
Decorators :
@Input()
|
click action parameter property |
import {
Directive,
ElementRef,
Input,
OnChanges,
OnInit,
SimpleChanges,
} from '@angular/core';
import {
FrameworkElement,
clickActionParameterProperty,
BindingInfo,
setDependencyPropertyValue,
BaseDirective,
} from '@mobilize/wms-framework';
/**
* Angular Directive for the wmClickActionParameter
*
* @export
* @class ClickActionParameterDirective
*/
@Directive({
selector: '[wmClickActionParameter]',
})
export class ClickActionParameterDirective
extends BaseDirective
implements OnInit, OnChanges
{
/**
* click action parameter property
*
* @type {any}
* @memberof ClickActionParameterDirective
*/
@Input()
wmClickActionParameter: string | BindingInfo;
/**
* Model of the element using the directive
*
* @type {any}
* @memberof ClickActionParameterDirective
*/
@Input()
model: any;
/**
* Constructor.
*
* @memberof ClickActionDirective
*/
constructor(private elementRef: ElementRef) {
super();
}
/**
* Angular life-cycle hook
*
* @param changes Simple changes parameter
*/
ngOnChanges(changes: SimpleChanges): void {
/* istanbul ignore else */
if (
changes.wmClickActionParameter &&
!changes.wmClickActionParameter.isFirstChange()
) {
this.setDependencyValue();
}
}
/**
* Event Handler for when the ngOninit.
*
* @memberof ClickActionParameterDirective
*/
/* istanbul ignore next */
ngOnInit(): void {
this.loadModel(this.elementRef);
this.setDependencyValue();
}
/**
* Sets the value to the Dependency property
*
* @memberof ClickActionParameterDirective
*/
setDependencyValue(): void {
if (this.model instanceof FrameworkElement) {
setDependencyPropertyValue(
clickActionParameterProperty,
this.wmClickActionParameter,
this.model
);
}
}
}