Added function wrapper to ngcontroller