Services in angular?

i have just started learning angular i came across following code in the constructor we are using private firebase: AngularFireDatabase is this automatically injected by angular or whats really happening?

import { Injectable } from '@angular/core';

import { AngularFireDatabase,AngularFireList } from 'angularfire2/database';

import { Employee } from './employee.model'; 

export class EmployeeService {

   employeeList: AngularFireList<any>;

   selectedEmployee: Employee = new Employee();
     constructor(private firebase: AngularFireDatabase) { }


      this.employeeList = this.firebase.list('employees');
      return this.employeeList;


     insertEmployee(employee : Employee){


        name :,
        position : employee.postition,
        salary :employee.salary



Yes, given it is in the module’s providers array.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.