@angular/material/button#MatButton TypeScript Examples
The following examples show how to use
@angular/material/button#MatButton.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: pagination.directive.ts From angular-custom-material-paginator with MIT License | 5 votes |
private createButton(index: string, pageIndex: number): MatButton {
const linkBtn: MatButton = this.renderer.createElement('button');
this.renderer.setAttribute(linkBtn, 'class', 'custom-paginator-page');
this.renderer.addClass(linkBtn, 'custom-paginator-page-enabled');
if (index === this.pageGapTxt[0] || index === this.pageGapTxt[1]) {
this.renderer.addClass(linkBtn, 'custom-paginator-arrow-enabled');
}
const pagingTxt = isNaN(+ index) ? this.pageGapTxt[0] : (+ index + 1);
const text = this.renderer.createText(pagingTxt + '');
this.renderer.addClass(linkBtn, 'mat-custom-page');
switch (index) {
case `${pageIndex}`:
this.renderer.setAttribute(linkBtn, 'disabled', 'disabled');
this.renderer.removeClass(linkBtn, 'custom-paginator-page-enabled');
this.renderer.addClass(linkBtn, 'custom-paginator-page-disabled');
break;
case this.pageGapTxt[0]:
this.renderer.listen(linkBtn, 'click', () => {
this.switchPage(this.currentPage < this.showTotalPages + 1
? this.showTotalPages + 2
: this.currentPage + this.showTotalPages - 1
);
});
break;
case this.pageGapTxt[1]:
this.renderer.listen(linkBtn, 'click', () => {
this.switchPage(this.currentPage > this.matPag.getNumberOfPages() - this.showTotalPages - 2
? this.matPag.getNumberOfPages() - this.showTotalPages - 3
: this.currentPage - this.showTotalPages + 1
);
});
break;
default:
this.renderer.listen(linkBtn, 'click', () => {
this.switchPage(+ index);
});
break;
}
this.renderer.appendChild(linkBtn, text);
// Add button to private array for state
this.buttons.push(linkBtn);
return linkBtn;
}
Example #2
Source File: pagination.directive.ts From angular-custom-material-paginator with MIT License | 5 votes |
private buttons: MatButton[] = [];
Example #3
Source File: color-toggle.component.ts From angular-material-components with MIT License | 5 votes |
@ViewChild('button') _button: MatButton;
Example #4
Source File: forgot-password.component.ts From matx-angular with MIT License | 5 votes |
@ViewChild(MatButton) submitButton: MatButton;
Example #5
Source File: lockscreen.component.ts From matx-angular with MIT License | 5 votes |
@ViewChild(MatButton) submitButton: MatButton;