As always, we won't be able to use the AuthService unless we add the required reference to the AppModule class. Open the app.module.shared.ts file and update it by adding the following highlighted lines:
[...]
import { RouterModule } from '@angular/router';
import { AuthService } from './services/auth.service';
import { AppComponent } from './components/app/app.component';
[...]
imports: [
CommonModule,
HttpClientModule,
FormsModule,
ReactiveFormsModule,
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'quiz/create', component: QuizEditComponent },
{ path: 'quiz/edit/:id', component: QuizEditComponent },
{ path: 'quiz/:id', component: QuizComponent },
{ path: 'question/create/:id', component: QuestionEditComponent
},
{ path: 'question/edit/:id', component: QuestionEditComponent
},
{ path: 'answer/create/:id', component: AnswerEditComponent },
{ path: 'answer/edit/:id', component: AnswerEditComponent },
{ path: 'result/create/:id', component: ResultEditComponent },
{ path: 'result/edit/:id', component: ResultEditComponent },
{ path: 'about', component: AboutComponent },
{ path: 'login', component: LoginComponent },
{ path: '**', component: PageNotFoundComponent }
])
],
providers: [
AuthService
]
[...]
That's it.