Added attachOnInit

This will allow the user to call a function when the controller is initialized