Use attachOnInit function