what's up!
a couple of words before we get to the actual answer just to make sure you know how to work with router module
const routes: Routes = [
{ path: "", pathMatch: "full", redirectTo: "home" },
{ path: "home", component: HomepageComponent },
{ path: "register", component: RegisterComponent },
{ path: "buyingmainpage", component: BuyingmainpageComponent , canActivate : [AuthGuard] },
{ path: "checkoutmainpage", component: CheckoutmainpageComponent , canActivate : [AuthGuard] },
{ path: "checkoutsuccess", component: CheckoutsuccessComponent , canActivate : [AuthGuard] },
{ path: "**", component: Eror404Component },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
tell me if this is familiar concept you are familiar with ?
the first step is to include the path of the url you want in the routes like the code above
the answer
the way to make this work in angular is by using Router
first you import it in the beginning of the code
import { Router } from '@angular/router';
then on the constructor function you declare it like this
constructor(
private router: Router,
) {}
then you can run the onClick function you wanted and use the function
router.navigateByUrl("/abc")
with a string inside it to navigate to the url you want :)
onClick(){
this.router.navigateByUrl("/checkoutmainpage")
}
if you want a video call i can help you ,
feel free to contact me on whats app or email , whats app will be quiker
+972505884960 / dolev146@gmail.com