0

I'm new to AngularJS, and i'm want to know what's the best and easiest practices to do this simple shop list application.

So this is my shop: enter image description here

I got three servers in my select input. Each server got own list of items, displayed in another component.

I'm thinking about creating routes with variables like localhost:4200/shop/{server1} which gonna show my list of items based on url path. Select option will just change path in my application to show shop list for specific server.

Is it a good practice, or there is better and easier solution to implement this simple shop application?

2 Answers 2

0

If you're asking if filtering data with routing is a good practice with Angular, I can say that it is not a bad one. Here's a link to the official Angular documentation about routing : Angular - Routing

But if you're asking if it is the only way to filter data or spread parameters, the answer is clearly no. Angular projects are SPA (Single Page Application), so you can do everything without touching the url.

For a quick example, you can attach a (click) event on your elements that display the shop list you want

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

Comments

0

I think you can use just one component and three different click events to display three different results. One component can work in your case. Using a router and routing logic for your requirement will be a costly affair. Your user will have a better application feel if these are covered in just one component and with three different click events.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.