Navigation between pages

Thread is closed for posting
3 posts, 1 answers
  1. Benny
    Benny avatar
    15 posts
    Member since:
    Apr 2015

    Posted 10 May 2015 Link to this post

    Hello,

    In your docs you explain how to pass context to a dynamically created page. But what if I have 2 xml defined pages?

    On the target page how do I get the context?

    How do I attach the pageNavigatedTo() handler in the pages' xml?

    Thanks in advance.

  2. Answer
    Nedim
    Nedim avatar
    5 posts
    Member since:
    Feb 2015

    Posted 10 May 2015 in reply to Benny Link to this post

    Add the event to the <Page ...> tag in the target view.

    <Page xmlns="http://www.nativescript.org/tns.xsd" navigatedTo="navigatedTo">

    Then in your .js file create the function. The args parameter has your navigationContext. 

    exports.navigatedTo = function (args) {
      var page = args.object;
      var dataItem = page.navigationContext;
      page.bindingContext = dataItem;
    };

  3. Benny
    Benny avatar
    15 posts
    Member since:
    Apr 2015

    Posted 11 May 2015 in reply to Nedim Link to this post

    Thanks Nedim
Back to Top