Este es mi archivo html
<button (click)="pay()">Add to Cart</button>Este es mi archivo ts
pay(){ Swal.fire( `Congratulations!!🤩`, `<h3>The item has been added to the cart!!<h3>`, 'success'); }Entonces, cuando hago clic en Aceptar (que aquí es un éxito), quiero que el usuario redirija a la página del carrito del sitio. ¿Cómo agrego un enlace?
Simplemente haga uso de las promesas de JavaScript. Ponga el método entonces después de la función swal. No necesitamos usar funciones de temporizador. Por ejemplo:
swal({ title: 'Request Delivered', text: 'You can continue with your search.', type: 'success' }).then(function() { window.location = "redirectURL"; })Gracias
pay(){ Swal.fire( `Congratulations!!🤩`, `<h3>The item has been added to the cart!!<h3>`, 'success').then(() => { this.router.navigate(['/yourCartPage']); }) }