Skip to content

Trigger $destroy on jqLite elements #36

@cozmy

Description

@cozmy

Currently, componentWillUnmount only calls this.state.scope.$destroy().
It should also "destroy" the compiled element so $destroy is trigger: https://docs.angularjs.org/api/ng/function/angular.element#events

$destroy - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM element before it is removed.

3rd party libraries depend on this: see $mdMenu fron AngularJS Material.

How to implement:

  1. In compile do: this.setState({ compiledElement: $injector.get('$compile')(element)(this.state.scope) });
  2. In componentWillUnmount do angular.element(this.state.compiledElement).empty();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions