Fixed ngCordova bug in controller