facultymatt / angular-unsavedChanges

angular-unsavedChanges
175 stars 81 forks source link

Looking to disable the directive based on condition #59

Open jmanuelrd opened 8 years ago

jmanuelrd commented 8 years ago

Hi, thank you for this great directive, I would like to disable/enable the directive based on a condition, is that possible with the existing code? if not, would it be a major change?

I'm thinking on something like this:

or Angular doesn't have a way to dynamically add/remove directives, that would require re-compiling, so my approach would be to always add the directive but enable/disable it's functionality based on a condition/boolean. Thanks!