File
Metadata
selector |
cd-back-button |
styleUrls |
./back-button.component.scss |
templateUrl |
./back-button.component.html |
back
|
Type : Function
|
Default value : () => this.location.back()
|
|
name
|
Type : string
|
Default value : this.actionLabels.CANCEL
|
|
import { Location } from '@angular/common';
import { Component, Input } from '@angular/core';
import { ActionLabelsI18n } from '../../constants/app.constants';
@Component({
selector: 'cd-back-button',
templateUrl: './back-button.component.html',
styleUrls: ['./back-button.component.scss']
})
export class BackButtonComponent {
constructor(private location: Location, private actionLabels: ActionLabelsI18n) {}
@Input() name: string = this.actionLabels.CANCEL;
@Input() back: Function = () => this.location.back();
}
<button class="btn btn-sm btn-default tc_backButton"
(click)="back()"
type="button">
{{ name }}
</button>
Legend
Html element with directive