src/lib/components/alink/alink.component.ts
Angular Component for the Alink Control.
ControlComponent
selector | wm-alink |
styleUrls | ./alink.component.scss |
templateUrl | ./alink.component.html |
Properties |
Methods |
Inputs |
constructor(wmService: WebMapService, refChange: ChangeDetectorRef, render2: Renderer2, elem: ElementRef, webComponents: WebComponentsService, bringTopServ1: BringTopService)
|
|||||||||||||||||||||
Creates an instance of AlinkComponent.
Parameters :
|
Target | |
Type : string
|
|
Default value : ''
|
|
Sets the target. |
clickHandler |
clickHandler()
|
Handler for the a tag click.
Returns :
void
|
Static NewPageEventArgsExtractor | |||||||||
NewPageEventArgsExtractor(event: any, component: AlinkComponent)
|
|||||||||
NewPageChange Extractor.
Parameters :
Returns :
any
{*} |
triggerPageChange | ||||||
triggerPageChange(event: any)
|
||||||
Decorators :
@serverEvent('NewPageChange', AlinkComponent.NewPageEventArgsExtractor)
|
||||||
Triggers the PageChange emitter.
Parameters :
Returns :
void
|
PageChange |
Type : EventEmitter<EventData>
|
Default value : new EventEmitter<EventData>()
|
PageChange event emitter. |
import {
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Input,
Optional,
Renderer2
} from '@angular/core';
import { WebMapService } from '@mobilize/angularclient';
import {
dataTransfer,
BringTopService,
EventData,
serverEvent
} from '@mobilize/base-components';
import {
ControlComponent,
WebComponentsService
} from '@mobilize/winforms-components';
import { ErrorCodes, ExceptionHandlerClass } from '@mobilize/webmap-core';
/**
* Angular Component for the Alink Control.
*
* @export
* @class AlinkComponent
* @extends {ControlComponent}
*/
@Component({
selector: 'wm-alink',
templateUrl: './alink.component.html',
styleUrls: ['./alink.component.scss'],
inputs: ['model']
})
@dataTransfer(['alnk'])
@ExceptionHandlerClass(ErrorCodes.Winforms)
export class AlinkComponent extends ControlComponent {
/**
* NewPageChange Extractor.
*
* @static
* @param {*} event
* @param {AlinkComponent} component
* @return {*} {*}
* @memberof AlinkComponent
*/
static NewPageEventArgsExtractor(event: any, component: AlinkComponent): any {
return [
null,
{ PageType: event.args.pageTarget, MapperId: 'NewPageChangeEventArgs' }
];
}
/**
* Sets the target.
*
* @memberof AlinkComponent
*/
@Input()
Target = '';
/**
* PageChange event emitter.
*
* @type {EventEmitter<EventData>}
* @memberof AlinkComponent
*/
PageChange: EventEmitter<EventData> = new EventEmitter<EventData>();
/**
* Creates an instance of AlinkComponent.
*
* @param {WebMapService} wmService
* @param {ChangeDetectorRef} refChange
* @param {Renderer2} render2
* @param {ElementRef} elem
* @param {WebComponentsService} webComponents
* @param {BringTopService} bringTopServ1
* @memberof AlinkComponent
*/
constructor(
private wmService: WebMapService,
private refChange: ChangeDetectorRef,
private render2: Renderer2,
private elem: ElementRef,
webComponents: WebComponentsService,
@Optional() private bringTopServ1: BringTopService
) {
super(refChange, render2, elem, webComponents, bringTopServ1);
}
/**
* Handler for the a tag click.
*
* @memberof AlinkComponent
*/
clickHandler() {
const eventData = new EventData('NewPageChange', this.id);
eventData.args = { pageTarget: this.Target };
this.triggerPageChange(eventData);
}
/**
* Triggers the PageChange emitter.
*
* @param {*} event
* @memberof AlinkComponent
*/
@serverEvent('NewPageChange', AlinkComponent.NewPageEventArgsExtractor)
triggerPageChange(event: any): void {
this.PageChange.emit(new EventData(event, this.id));
}
}
<a href="javascript:void(0)" (click)="clickHandler()" [ngClass]="class" wmControls [hostComponent]="this">
<ng-content></ng-content>
</a>
./alink.component.scss