Skip to content

Commit b707851

Browse files
committed
fix(action bar): attach #comment nodes with _addView
\#comment nodes should be added as views to 'actionBar' since they are anchors for the elements added by structural directive (*ngIf, *ngFor, etc.) closes #725
1 parent 184f887 commit b707851

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: nativescript-angular/directives/action-bar.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { Page } from "ui/page";
55
import { View } from "ui/core/view";
66
import { registerElement, ViewClassMeta, NgView } from "../element-registry";
77

8-
let actionBarMeta: ViewClassMeta = {
8+
const actionBarMeta: ViewClassMeta = {
99
skipAddToDom: true,
10-
insertChild: (parent: NgView, child: NgView, _atIndex: number) => {
10+
insertChild: (parent: NgView, child: NgView, atIndex: number) => {
1111
const bar = <ActionBar>(<any>parent);
1212
const childView = <any>child;
1313

@@ -17,13 +17,16 @@ let actionBarMeta: ViewClassMeta = {
1717
} else if (child instanceof ActionItem) {
1818
bar.actionItems.addItem(childView);
1919
childView.parent = bar;
20-
} else if (child.nodeName !== "#text" && child instanceof View) {
20+
} else if (child.nodeName === "#comment") {
21+
bar._addView(childView, atIndex);
22+
} else if (child instanceof View) {
2123
bar.titleView = childView;
2224
}
2325
},
2426
removeChild: (parent: NgView, child: NgView) => {
2527
const bar = <ActionBar>(<any>parent);
2628
const childView = <any>child;
29+
2730
if (child instanceof NavigationButton) {
2831
if (bar.navigationButton === childView) {
2932
bar.navigationButton = null;

0 commit comments

Comments
 (0)