fix(ivy): call hostBindings function with proper element index (#27694)

We invoked `hostBindings` function in Create and Update modes with different element index due to the fact that we did not subtract HEADER_OFFSET from the index before passing it to `hostBindings` function in Create mode. Now we subtract HEADER_OFFSET value before invoking `hostBindings`, which makes Ceate and Update calls consistent.

PR Close #27694
This commit is contained in:
Andrew Kushnir
2018-12-15 15:57:57 -08:00
committed by Miško Hevery
parent 4c1cd1bb78
commit 9bfe42840b
3 changed files with 57 additions and 22 deletions

View File

@ -198,7 +198,7 @@ export function createRootComponent<T>(
if (tView.firstTemplatePass && componentDef.hostBindings) {
const rootTNode = getPreviousOrParentTNode();
setCurrentDirectiveDef(componentDef);
componentDef.hostBindings(RenderFlags.Create, component, rootTNode.index);
componentDef.hostBindings(RenderFlags.Create, component, rootTNode.index - HEADER_OFFSET);
setCurrentDirectiveDef(null);
}