Search code examples
nativescriptangular2-nativescriptnativescript-telerik-ui

How to change Action bar for each Tab in Nativescript Angular


I hav TabBar app using Nativescript Angular. I want to change the Action Bar buttons based on the selected tab. I just follow this tutorial https://www.youtube.com/watch?v=7go3L70QfIQ

But, don't know how to use TabView.selectedIndexChangedEvent in Angular. If anyone has done this, please share the piece of code.

Thanks


Solution

  • I solve the issue using rxjs/Observable notifications. Logic is post a notification when the tab changes happen. Based on the tab index, I can decide the action bar button tap event methods.

        // send notify to child components
        let message = {
            "tabIndex" : this.tabIndex,
            "tappedButton" : "someButton"
        };
        this.notifyService.send(JSON.stringify(message));