Moving alert function and varible from angular run to alertController.