Creates an instance of CoursesComponent.
Angular Material dialog service for creating course dialog
Angular router for navigation
List of courses to display
Loading state indicator
Current authenticated user
Creates a new course with the provided title and description. Available only for teachers.
The title of the new course
The description of the new course
Loads courses in which the current student is enrolled. Sets loading state and handles errors.
Loads courses taught by the current teacher. Sets loading state and handles errors.
Initializes the component and subscribes to user data changes. Loads appropriate courses based on the user's role (teacher or student).
Opens a dialog for creating a new course. Available only for teachers.
Refreshes the current page to show updated course data. Uses a navigation trick to force Angular to reload the component.
Component responsible for displaying and managing a list of courses. Shows different courses and provides different functionality based on whether the user is a teacher or student. Teachers can create new courses and see courses they teach. Students can see courses they are enrolled in.