Closed mulatorarg closed 5 years ago
I also have this issue @Gabrielus , were you able to solve it?
Yes. But now I do not remember the code used. Then I share the solution. Thanks for asking!!
Unfortunately the TypeScript definitions file associated with this library has many issues. To solve this one use it like so:
content: {
element: "input"
}
I'm still trying to use the buttons
option as shown in the docs using TypeScript.
swal("Type something:", {
content: "input",
} as any)
.then((value) => {
swal(`You typed: ${value}`);
})
Thank you all. I had already solved it a long time ago. I share my solution and I close the issue.
async preCambiarClave() {
const value = await swal('Ingrese la nueva contraseña (mínimo 6 caracteres):', {
content: {
element: 'input',
attributes: {
placeholder: 'Nueva contraseña',
type: 'password',
value: ``
}
}
});
if (value.length >= 6) {
this.usuario.clave = value;
this.cambiarClave();
} else {
swal('Ups', 'La contraseña debe tener al menos 6 caracteres.', 'error');
}
}
By following the example:
Or its version with promises
Throw messages: