Skip to content

Commit f73cbc2

Browse files
committed
Merge pull request NativeScript#197 from NativeScript/hdeshev/sidedrawer-fix
Attaching a node to a parent remembering templateParent.
2 parents 7970152 + 0270da0 commit f73cbc2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/nativescript-angular/renderer.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,17 @@ export class NativeScriptRenderer extends Renderer {
114114

115115
attachViewAfter(anchorNode: NgView, viewRootNodes: NgView[]) {
116116
traceLog('NativeScriptRenderer.attachViewAfter: ' + anchorNode.nodeName + ' ' + anchorNode);
117-
const parent = (<NgView>anchorNode.parent || anchorNode.templateParent);
117+
//HACK: The anchor.templateParent precedence and child.templateParent
118+
//assignment are a workaround for RadSideDrawer.
119+
//Remove it once we ship the fix in the RadSideDrawer directives.
120+
const parent = (anchorNode.templateParent || <NgView>anchorNode.parent);
118121
const insertPosition = this.viewUtil.getChildIndex(parent, anchorNode);
119122

120123
viewRootNodes.forEach((node, index) => {
121124
const childIndex = insertPosition + index + 1;
125+
//Remember the template parent in case someone moves the view element
126+
//before Angular attaches the next view.
127+
node.templateParent = parent;
122128
this.viewUtil.insertChild(parent, node, childIndex);
123129
this.animateNodeEnter(node);
124130
});

0 commit comments

Comments
 (0)