N
N
Ness2021-03-08 21:50:35
Angular
Ness, 2021-03-08 21:50:35

How to make routing on asp.net webforms + angularjs transition from one page to another with a parameter?

There is a task: you need to go from the page of organizations with a table by clicking on the button to the page with a table of users and this table of users should be filtered by the organization whose id we passed to the routesparams. Can this be done somehow on angularjs + asp.net web forms?

The link should look like this: localhost/users?org=123

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Django Almighty, 2021-03-09
@12345678XYU87654321

Use full web api and full js js or just angular. Don't try crossbreeding web forms with angular. Angular elegantly performs various routing and forwarding on its own.
ActivatedRoute holds the router's state tree in Angular's memory.

constructor(private activatedRouter:ActivatedRoute) { }

ngOnInit(): void {
console.log(this.activatedRouter.snapshot.params['id']);
}

This code will display in the console the 'id' parameter that we passed.
Yes, by the way, we pass the parameters as follows:
[routerLink]="['/post', post.id]"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question