Mobile Builder – Page Data

Home Forums Convertigo Products Mobile Builder – Page Data

This topic contains 1 reply, has 2 voices, and was last updated by  Gregory Vorbe 10 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #236025

    Darren Bryant
    Participant

    I would like to dynamically set data to be passed to a page using typescript in the Page data property. The notes say that this should be an object, not text. What format can I use to build the object using a TypeScript expression? I have tried several but I always end up getting an error “Resolve Error : TypeError: Cannot read property ‘substring’ of undefined”

    #236028

    Gregory Vorbe
    Moderator

    Hello Darren,

    In the “Page data” property of a “Push page” action the data format has to be a JSON object.
    For example:

    _ Directly in the property, in TS mode:

    {'test': 'data', 'test2': 25}

    In this case, this must be used with single quotes only.

    _ In the page class, you define your object variable:

    /*Begin_c8o_PageDeclaration*/
    	public PageData: object = {"test": "data", 'test2': 25};
    	/*End_c8o_PageDeclaration*/

    And in the “Page data” property:
    this.PageData

    You can retrieve your data in the new page with:

    this.navParams.data

    or

    JSON.stringify(this.navParams.data)

    to get it as a string.

    QA&Support

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.