From the course: Learning Angular
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Solution: Add a model
(upbeat music) - [Instructor] All right, let me show you how we can add a student model. ng generate interface, and I want the student model to be in the models folder. So the model slash student, and again, I want to make sure it has type in the name for code organization. And there we go. It has created the model, and I'm only going to do the must haves, so an ID number, a name of type string, and the email that's possibly empty. So it's an optional field, and the enrolled course ID, which is also optionally empty, which contains a number array because the IDs are of type number. And that is it. That's how we can create a student model. We use this later in the course, so make sure you have it if you want to follow along.