Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
how do I add a page link in the ok button of Swal in Angular?

This is my html file

<button (click)="pay()">Add to Cart</button>

This is my ts file

pay(){
    Swal.fire(
      `Congratulations!!🤩`,
      `<h3>The item has been added to the cart!!<h3>`,
      'success');
  }

So, when I click on the OK(which in here is success), I want user to redirect to the Cart Page of the site. How do I add a link?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Just make use of JavaScript promises. Put the then method after swal function. We do not need to use timer features. For example:

  swal({
      title: 'Request Delivered',
      text: 'You can continue with your search.',
      type: 'success'
    }).then(function() {
        window.location = "redirectURL";
    })

Thank you

about 4 years ago · Juan Pablo Isaza Report

0

pay(){
    Swal.fire(
      `Congratulations!!🤩`,
      `<h3>The item has been added to the cart!!<h3>`,
      'success').then(() => {
            this.router.navigate(['/yourCartPage']);
    })
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!