@nahuelmorata/ngx-command v18.1.2
NgxCommand
Implementacion del patron de Command para angular. El uso principal es para la deshabilitacion del boton mientras se ejecuta
Contacto
Versiones
| Version | Angular Version |
|---|---|
| v1.x.x | v9.x.x |
| v2.x.x | v10.x.x |
| v3.x.x | v11.x.x |
| v4.x.x | v12.x.x |
| v5.x.x | v13.x.x |
| v6.x.x | v14.x.x |
| v7.x.x | v15.x.x |
| v8.x.x | v16.x.x |
| v17.x.x | v17.x.x |
| v18.x.x | v18.x.x |
Instalacion
Con npm
npm i @nahuelmorata/ngx-commandCon yarn
yarn add @nahuelmorata/ngx-commandUso
Agregar modulo
import { NgxCommandModule } from '@nahuelmorata/ngx-command';
@NgModule({
imports: [
NgxCommandModule
]
})
export class AppModule {}En el componente
import { ICommand, CommandAsync } from '@nahuelmorata/ngx-command';
@Component({})
export class AppComponent {
public accionCmd: ICommand = new CommandAsync(() => this.accion());
private async accion() {
}
}En el template
<button [command]="accionCmd">Accion</button>Con parametros
En el componente
import { ICommand, CommandAsync } from '@nahuelmorata/ngx-command';
@Component({})
export class AppComponent {
public accionCmd: ICommand = new CommandAsync((parametro: string) => this.accion(parametro));
private async accion(parametro: string) {
console.log(parametro); // 'texto'
}
}En el template con un solo parametro
<button [command]="accionCmd" commandArg="texto">Accion</button>O
En el template con varios parametros
<button [command]="accionCmd" [commandArgs]="['texto', 'otro']">Accion</button>6 months ago
8 months ago
6 months ago
6 months ago
6 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago