use angularjs promises if available