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); + } } }