Skip to content

Commit 8967b0b

Browse files
committed
docs: note about NgZone
1 parent 5dc3e79 commit 8967b0b

File tree

1 file changed

+15
-1
lines changed
  • app/ng-ui-widgets-category/bottom-navigation/events

1 file changed

+15
-1
lines changed

app/ng-ui-widgets-category/bottom-navigation/events/article.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,18 @@
22
- `oldIndex` - Provides the old selected index.
33
- `newIndwex` - Provides the new selected index.
44

5-
<snippet id='bottom-navigation-events-ng'/>
5+
<snippet id='bottom-navigation-events-ng'/>
6+
7+
> **Note:** Any UI event declared throught the HTML markup will be automatically wrapped in the Angular zone. This is not the case when the events are declared thorugh the code behind (e.g., when using `on`) so in such cases we need to manually wrap any event that will be called from a native code:
8+
```TypeScript
9+
constructor(private _zone: NgZone) { }
10+
11+
// .. more code follows here
12+
13+
bottomNavigation.on(BottomNavigation.selectedIndexChangedEvent, (data: SelectedIndexChangedEventData) => {
14+
// manually wrap in the NgZone when using the event via code-behind
15+
this._zone.run(() => {
16+
this.selectedIndex = newIndex;
17+
});
18+
});
19+
```

0 commit comments

Comments
 (0)