How do I access navCtrl: NavController programmatically via a CustomAction?

Home Forums Convertigo developers Forums as moved to Stack Overflow. How do I access navCtrl: NavController programmatically via a CustomAction?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #243810


    I want to access navCtrl: NavController programmatically via CustomAction.

    Could you show me how I can do that?




    Gregory Vorbe

    Hello Jalal,

    In which case do you need to access the NavController class?



    Hello Grégory,

    I am trying to use rootPage or popPage or pushPage in my project with slidingTabs component. When I click on back button, the called page is displayed in slidingTab.

    Now I think to resolve that issue, I try to use ModalPage. But I have to add a back button on navBar in header page and link to it a customAction to go the corresponding page.

    This is my idea to use NavController class.




    Gregory Vorbe

    Closing a ModalPage goes back to previous page.
    If you use Convertigo Studio 7.5.3 you can add a CloseModal bean on onTap event of a button, for example, to close the ModalPage.
    Prior to 7.5.3, to close a ModalPage in a customAction you have to:

    _ Edit page class and add:

    import { ViewController }                                                            from 'ionic-angular';

    _ Add code to your customAction:

    let pageModal = this.getInstance(ViewController);

    Note : Depending on devices resolution, ModalPage are not necessarly fullscreen, and are not meant to be used as navigation page.
    Note2 : NavController class can not be used in Mobile Builder architecture



    Gregory Vorbe

    If you want to push a page in a customAction, you can write:

    this.router.push(page.getPageByName("Page1"), null, {"animate": true, "duration": 250})

    Where Page1 is the name of a page in your application.
    The name of the page can be found in the property ‘Name’ when clicking a page in the “Pages” tree view, under “Application”.

    Edit: you can also use pop() and setRoot(view, data, options)


    • This reply was modified 3 years, 2 months ago by Gregory Vorbe.
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.