5
Injectable 클래스가 인스턴스화 될 때 ngOnInit가 호출되지 않음
클래스가 해결 ngOnInit()될 때 왜 호출 되지 Injectable않습니까? 암호 import {Injectable, OnInit} from 'angular2/core'; import { RestApiService, RestRequest } from './rest-api.service'; @Injectable() export class MovieDbService implements OnInit { constructor(private _movieDbRest: RestApiService){ window.console.log('FROM constructor()'); } ngOnInit() { window.console.log('FROM ngOnInit()'); } } 콘솔 출력 FROM constructor()