Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix(removePatch): fire $destroy event when full jQuery is used #1509

Closed
wants to merge 1 commit into from

Conversation

PeteAppleton
Copy link

This patch corrects a problem observed when using ngRepeat to create required inputs inside a form. If the user removed the text from an input (making it invalid) and then carried out an action to delete the appropriate part of the model then the input element was never removed from the form, causing the form to stay $invalid although in fact all current elements were $valid. Because the form then had an invalid validation token retained for a destroyed control it was not possible to recover the correct state for the form without destroying it.

The previous code relied upon internal jQuery structures which are not present in v.1.8.2 (current). This code uses the public API to fire the $destroy custom event, and so should work with any post-1.4 jQuery version.

The previous code relied upon internal jQuery structures which are not
present in v.1.8.2 (current).  This code uses the public API to fire the
$destroy custom event, and so should work with any post-1.4 jQuery
version.
@PeteAppleton
Copy link
Author

Although this modification corrects the initial problem, it introduces others because the $destroy event bubbles whereas the original code does not. This bubbling has the highly undesirable effect of the parent form being destroyed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant