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

Home Forums Convertigo Products How do I access navCtrl: NavController programmatically via a CustomAction?

This topic contains 4 replies, has 2 voices, and was last updated by  Gregory Vorbe 5 months, 3 weeks ago.

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

    Hello,

    I want to access navCtrl: NavController programmatically via CustomAction.

    Could you show me how I can do that?

    Regards,

    Jalal

    #243811

    Gregory Vorbe
    Moderator

    Hello Jalal,

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

    QA&Support

    #243812

    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.

    Regards,

    Jalal.

    #243813

    Gregory Vorbe
    Moderator

    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:

    /*Begin_c8o_PageImport*/
    import { ViewController }                                                            from 'ionic-angular';
    /*End_c8o_PageImport*/

    _ Add code to your customAction:

    let pageModal = this.getInstance(ViewController);
    pageModal.dismiss();

    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

    QA&Support

    #243814

    Gregory Vorbe
    Moderator

    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)

    QA&Support

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

You must be logged in to reply to this topic.