LoginSignup
0
1

More than 5 years have passed since last update.

Angular2で親クラスのコンストラクタを呼び出す方法

Posted at

こんな感じでsuperで呼びます

今回、これを使った理由としては、親クラスのメソッドのhttp:Httpモジュールを
使用しようとした際に、httpオブジェクトがありません。というような
エラーが多発しており、使いました!!

@Injectable()
export class ChildService extends ParentService{
  constructor (private http:Http, private customService:CustomService){
    super(http, customService);
  }
}
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1