Updating promise api for angularjs