import { Component , OnInit , ViewContainerRef } from '@angular/core' ; import { QuestionService } from './question.service' ; import { QuestionModel } from './question.model' ; import { LoadingService } from '../../core/loading/loading.service' ; @ Component ( { selector : 'question' , styleUrls : [ './question.scss' ] , templateUrl : './question.html' } ) export class QuestionComponent implements OnInit { questions : QuestionModel [ ] ; error : any ; constructor ( private questionService , private loadService , private viewContainer ) { } ngOnInit ( ) { this . loadService . show ( this . viewContainer ) ; this . questionService . getQuestions ( ) . subscribe ( result => { this . questions = result ; } , ( error ) => { this . error = error ; } , ( ) => this . loadService . hide ( ) ) ; } }