title: Angular NullInjectorError No Provider for Service?
body: <p>In my code, I have some buttons and when you click them, a pop-up should open, and you are supposed to see the details in the form of a list. Whenever I click those buttons, I get the error below. I don't know why I can't reach the property I want. What could be wrong with my code, and How can I fix it?</p>
  <p>TS Code:</p>
  <pre><code>@Component({
    selector: 'warehouse-detail-dialog',
    templateUrl: './warehouse-detail-dialog.component.html',
    styleUrls: ['./warehouse-detail-dialog.component.scss']
  })
  export class WarehouseDetailDialogComponent implements OnInit {
  
    cell: ICell;
    userRights: IActionRoleMap;
  
  
    displayedColumns: string[] = [
      'EntryPackageBarcode',
      'StockIntegrationCode',
      'ProductName',
      'Balance',
  ];
  dataSource: MatTableDataSource&lt;IStockPackageTransaction&gt;;
  
  @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
  @ViewChild(MatSort, { static: true }) sort: MatSort;
  
  
    /**
     *
     */
    constructor(
        private _terminalService: TerminalService,
        private _router: Router
    ) {
  
      _terminalService.onCellDetailChanged.subscribe((response: ICell) =&gt; {
        this.cell = response;
        
  
        this.dataSource = new MatTableDataSource(response.StockPackageTransactions);
        this.dataSource.paginator = this.paginator;
        this.dataSource.sort = this.sort;
  
    });
  
       
    }
  </code></pre>
  <p>TS for Service:</p>
  <pre><code>cellDetail: ICell;
      onCellDetailChanged: BehaviorSubject&lt;any&gt; = new BehaviorSubject([]);
   getCellDetailById(id: string) {
          return new Promise((resolve, reject) =&gt; {
              this._http
                  .get(&quot;Production/GetCellDetailById/&quot; + id)
                  .subscribe((response: ICell) =&gt; {
                      this.cellDetail = response;
                      this.onCellDetailChanged.next(this.cellDetail);
                      resolve(this.cellDetail);
                  }, reject);
          });
      }
  </code></pre>
  <p>Error:</p>
  <pre><code>WarehouseDetailDialogComponent_Host.ngfactory.js? [sm]:1 ERROR NullInjectorError: StaticInjectorError(AppModule)[WarehouseDetailDialogComponent -&gt; TerminalService]: 
    StaticInjectorError(Platform: core)[WarehouseDetailDialogComponent -&gt; TerminalService]: 
      NullInjectorError: No provider for TerminalService!
      at NullInjector.get (core.js:778)
      at resolveToken (core.js:2564)
      at tryResolveToken (core.js:2490)
      at StaticInjector.get (core.js:2353)
      at resolveToken (core.js:2564)
      at tryResolveToken (core.js:2490)
      at StaticInjector.get (core.js:2353)
      at resolveNgModuleDep (core.js:26403)
      at NgModuleRef_.get (core.js:27491)
      at resolveNgModuleDep (core.js:26403)
  </code></pre>