Implementing Functionality to Add a New Course
Learn how to implement the functionality of adding a new course
To implement the functionality to add a course, we’ll head over to the dashboard components of our application and follow the steps below:
Step 1: Setting up the FormBuilder
We start by heading to our create-course directory. We currently have the design implemented, but we’re yet to configure FormBuilder, FormGroup, and Validators. To do that, we’ll head over to the create-course.component.ts file and implement the code below:
Below is a summary of the above code:
- We start by importing the
FormBuilder,FormGroup, andValidatorsin line 2. - Next, we create a
createForm!variable in line 9. This variable holds the instance of theFormGroup. The exclamation mark at the end of the variable serves as an initializer to help prevent TypeScript errors. - In line