Angular - Services and Dependency Injection
Given this Angular component code snippet, what will be logged to the console?
import { Component, inject } from '@angular/core';
import { LoggerService } from './logger.service';
@Component({
selector: 'app-sample',
standalone: true,
template: `Check console
`,
providers: [LoggerService]
})
export class SampleComponent {
private logger = inject(LoggerService);
constructor() {
this.logger.log('Hello from SampleComponent');
}
}