How to roll back changes when there is an error in a promise chain
问题 In my angular app I want to make changes to several locations in my firebase with a mix of transactions and set. I have written a promise chain with a little help. Now I need to handle any errors that may occur. In the event of an error on any of the promises I would want to roll back any changes made in firebase (the successful promises) and alert the user to the failure. Current code below $scope.addNewPost = function() { var refPosts = new Firebase(FBURL).child('/posts').push(); // Get