Skip to content

Instantly share code, notes, and snippets.

@alexzuza
Created May 19, 2018 13:01
Show Gist options
  • Save alexzuza/301be545c9cf8a61132960a0a7ce8929 to your computer and use it in GitHub Desktop.
Save alexzuza/301be545c9cf8a61132960a0a7ce8929 to your computer and use it in GitHub Desktop.
Ivy detect changes
export function detectChanges<T>(component: T): void {
const hostNode = _getComponentHostLElementNode(component);
ngDevMode && assertNotNull(hostNode.data, 'Component host node should be attached to an LView');
const componentIndex = hostNode.tNode !.flags >> TNodeFlags.DirectiveStartingIndexShift;
const def = hostNode.view.tView.directives ![componentIndex] as ComponentDef<T>;
detectChangesInternal(hostNode.data as LView, hostNode, def, component);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment