在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):michaeldoye/mat-progress-buttons开源软件地址(OpenSource Url):https://github.com/michaeldoye/mat-progress-buttons开源编程语言(OpenSource Language):TypeScript 67.7%开源软件介绍(OpenSource Introduction):Anguar Material Design Progress ButtonsDemoView all the directives in action at https://mat-progress-buttons.firebaseapp.com StackBlitz demo https://stackblitz.com/edit/mat-progress-buttons-demo Dependencies
InstallationInstall above dependencies via npm. Now install npm install --save mat-progress-buttons SystemJS
map: {
'mat-progress-buttons': 'node_modules/mat-progress-buttons/bundles/mat-progress-buttons.umd.js',
} Once installed you need to import the main module: import { MatProgressButtonsModule } from 'mat-progress-buttons'; The only remaining part is to list the imported module in your application module. The exact method will be slightly
different for the root (top-level) module for which you should end up with the code similar to (notice import { MatProgressButtonsModule } from 'mat-progress-buttons';
@NgModule({
declarations: [AppComponent, ...],
imports: [MatProgressButtonsModule.forRoot(), ...],
bootstrap: [AppComponent]
})
export class AppModule {
} Other modules in your application can simply import import { MatProgressButtonsModule } from 'mat-progress-buttons';
@NgModule({
declarations: [OtherComponent, ...],
imports: [MatProgressButtonsModule, ...],
})
export class OtherModule {
} UsageSpinner Buttonimport { Component } from '@angular/core';
import { MatProgressButtonOptions } from 'mat-progress-buttons';
@Component({
selector: 'app-home',
template: '<mat-spinner-button (btnClick)="btnClick()" [options]="btnOpts"></mat-spinner-button>'
})
export class SomeComponent {
// Button Options
btnOpts: MatProgressButtonOptions = {
active: false,
text: 'Stroked Button',
spinnerSize: 19,
raised: false,
stroked: true,
flat: false,
fab: false,
buttonColor: 'accent',
spinnerColor: 'accent',
fullWidth: false,
disabled: false,
mode: 'indeterminate',
customClass: 'some-class',
// add an icon to the button
buttonIcon: {
fontSet: 'fa',
fontIcon: 'fa-heart',
inline: true
}
};
// Click handler
btnClick(): void {
this.btnOpts.active = true;
setTimeout(() => {
this.btnOpts.active = false;
}, 3350);
}
}; Spinner button FABYou can use the spinner button with a To set up fontawesome to work with Use the Note: Bar Button does not support the
Icon API
More info in Angular Material Docs Bar Buttonimport { Component } from '@angular/core';
import { MatProgressButtonOptions } from 'mat-progress-buttons';
@Component({
selector: 'app-home',
template: '<mat-bar-button (btnClick)="btnClick()" [options]="btnOpts"></mat-bar-button>'
})
export class SomeComponent {
// Button Options
btnOpts: MatProgressButtonOptions = {
active: false,
text: 'Stroked Button',
buttonColor: 'accent',
barColor: 'accent',
raised: false,
stroked: true,
flat: false,
mode: 'indeterminate',
value: 0,
disabled: false,
customClass: 'some-class',
// add an icon to the button
buttonIcon: {
fontSet: 'fa',
fontIcon: 'fa-heart',
inline: true
}
};
// Click handler
btnClick(): void {
this.btnOpts = { ...this.btnOpts, active: true };
setTimeout(() => {
this.btnOpts = { ...this.btnOpts, active: false };
}, 3350);
}
}; Global OptionsOptionally pass default const button1: MatProgressButtonOptions = {
id: 'button1', // Id should match the [buttonId] input
...
};
const button2: MatProgressButtonOptions = {
id: 'button2', // Id should match the [buttonId] input
...
};
@NgModule({
imports: [
MatProgressButtonsModule.forRoot([button1, button2]),
],
declarations: [HomeComponent],
})
NB: add the id above should match the id provided in the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论