facultymatt / angular-unsavedChanges

angular-unsavedChanges
175 stars 81 forks source link

Only one resettable being reset? #47

Open zbend opened 9 years ago

zbend commented 9 years ago

I found only one of my resetables was being reset. I adjusted the code to this:

var resettables = formElement[0].querySelectorAll('[resettable],[data-resettable]');
for (var i = 0; i < resettables.length;i++) {
    scope.$apply(angular.element(resettables[i]).triggerHandler('resetResettables'));    
}

It seems to work now. I didn't spend much time so let me know if I'm missing something and this is not actually needed.