import {Component, CUSTOM_ELEMENTS_SCHEMA} from '@angular/core'; import {Tutorial} from '../../models/tutorial.model'; import {TutorialService} from '../../services/tutorial.service'; import {MatCard, MatCardContent, MatCardHeader} from '@angular/material/card'; import {MarkdownComponent} from 'ngx-markdown'; import {authInterceptorProviders} from '../../helpers/auth.interceptor'; import {HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi} from '@angular/common/http'; import {CustomHttpInterceptor} from '../../helpers/custom-http-interceptor'; @Component({ selector: 'app-tutorials.component', imports: [ MatCard, MatCardContent, MatCardHeader, MarkdownComponent ], templateUrl: './tutorials.component.html', styleUrl: './tutorials.component.scss', schemas: [CUSTOM_ELEMENTS_SCHEMA], providers: [authInterceptorProviders,{ provide: HTTP_INTERCEPTORS, useClass: CustomHttpInterceptor, multi: true }], }) export class TutorialsComponent { tutorials?: Tutorial[]; constructor(private tutorialService: TutorialService) { this.retrieveTutorials(); } // ngOnInit(): void { // this.retrieveTutorials(); // } retrieveTutorials(): void { this.tutorialService.getAllPublic().subscribe( (data : Tutorial[]) =>{ this.tutorials = data; console.log(data); }, error => { console.log(error); } ); } }