Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Docs for NgAttachAware and NgDetachAware not useful #673

Open
@yjbanov

Description

@yjbanov

The docs for NgAttachAware and NgDetachAware are too fuzzy to be useful. It makes it hard to rely on any sequence of events.

NgAttachAware

/**
 * Implementing directives or components [attach] method will be called when
 * the next scope digest occurs after component instantiation. It is guaranteed
 * that when [attach] is invoked, that all attribute mappings have already
 * been processed.
 */

Issues:

  • In Dart, instance methods can only be called after instantiation, so this part is not useful, unless you are referring to some other definition of "instantiation". I think you are trying to say "the first scope digest".
  • In "when the next scope digest occurs" the "when" doesn't actually tell me if it will happens immediately before, immediately after or at a certain point in the middle of the scope digest.
  • "all attribute mappings" seems to mean ones declared by the implementing component via @NgComponent or annotations, such as @NgTwoWay. However, I'm also observing that Angular calls the getters on my component that are bound in the template of this same component, before calling attach. Could this be a bug?

NgDetachAware

/**
 * Implementing directives or components [detach] method will be called when
 * the associated scope is destroyed.
 */

Issues:

  • Same problem with the word "when" as the one in @NgAttachAware.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions