title: How to use service in Component?
body: <p>When I inject UserService then component it doesn't appear
  When I remove service from component then component works fine</p>
  
  <p>providers in  @NgModule</p>
  
  <pre><code>providers: [
      UserService,
      {
        provide:AuthServiceConfig,
        useFactory: getAuthServiceConfigs
      }
    ],
  </code></pre>
  
  <p>Service Code</p>
  
  <pre><code>@Injectable()
  export class UserService {
      API_URL = environment.apiUrl;
  
      constructor(private http: HttpClient) { }
  
      getAll() {
          return this.http.get&lt;User[]&gt;(this.API_URL+"getAllUsers");
      }
  }
  </code></pre>
  
  <p>Component Code</p>
  
  <pre><code>export class UserRegistrationComponent implements OnInit {
  
    registerForm: FormGroup;
    submitted = false;
    newUser;
    userService: UserService;
     constructor(
          userService: UserService        
          ) 
         {
          config.backdrop = 'static';
          config.keyboard = false;
          this.userService=userService;
         }
  
    ngOnInit() {
        this.registerForm = this.formBuilder.group({
            emailId: ['', Validators.required],
            firstName: ['', Validators.required],
            lastName: ['', Validators.required],
            password: ['', [Validators.required, Validators.minLength(8)]]
        });
    }
  }
  </code></pre>