title: Why do my Angular Services work without specifying them in the provider argument of the @Component annotation?
body: <p>I'm following a Udemy course for angular and the teacher says we need to specify the services we want to import in the providers section of the @Component annotation, to tell Angular which service needs to be injected in this component. But my component works fine without specifying it.</p>
  
  <p>Why is that ?</p>
  
  <p>This is my component </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import { Component, EventEmitter, Input, Output } from '@angular/core';
  import {AccountService} from "../services/account-service";
  
  @Component({
    selector: 'app-account',
    templateUrl: './account.component.html',
    styleUrls: ['./account.component.css']
  })
  export class AccountComponent {
    @Input() account: {name: string, status: string};
    @Input() id: number;
  
    constructor(private accountService:AccountService) {
    }
  
    onSetTo(status: string) {
      this.accountService.updateStatus(this.id,status);
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>And this is the service </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import { Injectable } from '@angular/core';
  import {LoggingService} from "./logging.service";
  
  @Injectable({
    providedIn: 'root'
  })
  export class AccountService {
    accounts = [
      {
        name: 'Master Account',
        status: 'active'
      },
      {
        name: 'Testaccount',
        status: 'inactive'
      },
      {
        name: 'Hidden Account',
        status: 'unknown'
      }
    ];
    constructor(private loggingService: LoggingService) { }
  
    addAccount(name:string, status:string){
      this.accounts.push({name:name, status:status})
      this.loggingService.logStatusChanged(status)
    }
  
    updateStatus(id:number,status:string){
      this.accounts[id].status = status;
      this.loggingService.logStatusChanged(status)
    }
  }</code></pre>
  </div>
  </div>
  </p>