0

Let’s say I want route to a url as localist:8888/apps/my page

So this route should be set in angular components or .net mvc controller? Or both places.

My situation is I have a controller load all initial data already.do I create a new controller for this specific route?

3 Answers 3

1

Is that URL supposed to be exposed in your API or to render a page in the frontend?

If you want to expose this route in your API, you would need a new Controller for this. Then you could consume it in your Angular app making a request to that URL with the HttpRequest Action needed (GET, POST, PUT, etc...).

If you want to render some content in that url with your Angular app, then you would need to set the specific route to perform this action and refer to a component. (https://angular.io/start/routing).

Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

0

Yes, you need to create the controller and view called mypage then create a component and render into .cshtml page.

Then you can access your page which you need to access # localhost:8888/apps/mypage

Comments

0

The first time you navigate to your application, WebAPI will serve an html page + return the angular application to your browser. As soon as you receive the angular source, the navigation is handled by angular client-side. That means you do not emit any request to your WebAPI and therefore won't reach any controller.

The only routes you should create in your Controller are the one you want to request (with HttpClient for example, post/get/...).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.