Adding Categories Bar
In this lesson, we're going to add Categories bar
Adding Categories bar#
We have spent a lot of time working on the categories. We have made a different controller and a different DbSet for this. I want to use this just below our navigation bar. I have seen a lot of e-learning applications using categories like that, so let's start working on that.
Let's go to our
agent.ts file first. Like Courses, let's make another const model called category inside
models folder. This will have an id of type number, name of type string and course which can either be array of Course, or an empty array or null.
Now let's go back to the
agent.ts file and create Categories like we have Courses. Inside, we will use the list again. This time, type will be an array of category and the endpoint wil be categories instead of courses.
We can now add it to the agent object.