From 8c972982d04c08c9c4abb9e0214ead576e54305e Mon Sep 17 00:00:00 2001 From: vakrilov Date: Mon, 21 Dec 2015 18:09:54 +0200 Subject: [PATCH] Handle content view add/remove child --- src/nativescript-angular/view_node.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/nativescript-angular/view_node.ts b/src/nativescript-angular/view_node.ts index 065b2dcb5..1e53f0faa 100644 --- a/src/nativescript-angular/view_node.ts +++ b/src/nativescript-angular/view_node.ts @@ -123,6 +123,8 @@ export class ViewNode { } else { parentLayout.addChild(this.nativeView); } + } else if (this.parentNativeView instanceof ContentView) { + (this.parentNativeView).content = this.nativeView; } else if ((this.parentNativeView)._addChildFromBuilder) { (this.parentNativeView)._addChildFromBuilder(this.viewName, this.nativeView); } else if (this.parentNode.isComplexProperty) { @@ -334,10 +336,15 @@ export class ViewNode { this.detachUIEvents(); if (this.nativeView) { let nativeParent = this.nativeView.parent; - if (nativeParent instanceof LayoutBase) { - (nativeParent).removeChild(this.nativeView); - } else { - nativeParent._removeView(this.nativeView); + if (nativeParent) { + if (nativeParent instanceof LayoutBase) { + (nativeParent).removeChild(this.nativeView); + } else if (nativeParent instanceof ContentView) { + (nativeParent).content = undefined; + } + else { + nativeParent._removeView(this.nativeView); + } } }