What is the Page JavaScript object? | Aquro Help Center

A specific JavaScript object called Page is included in all apps built inside Aquro App Studio. This object contains some different method and properties that is used inside the Platform for different tasks.

This article covers the methods and properties included in the Page-object.

Methods:

Properties:

Page.State object

The Page.State object is used to store the active data and current state for a page to be used inside Page Templates and Visual Coding.

The object is set when calling Page.Load and contains the values passed in the stateObject argument to the Page.Load function. When the data is loaded for a page this data is also added to the Page.State.Data object.

When using Visual Coding and using the Page.Load manager you may pass an ID to the state, this ID will be stored in the as Page.State.PassedID.

Page.State.LoggedIn and Page.State.LoggedInUserID is also set to contain information about the logged in user.

This is the an example of the Page.State object on a page:

{
   PassedID : "481adad7-469b-4937-9a8d-33e26ba9dd67",
   LoggedIn : true,
   LoggedInUserID : "98842022-3ac9-41a7-be66-e13f9d93a70b",
   Data : {
      Persons : [
         {
            Id : "9ec0eb5f-00f4-46d4-809f-dc3f7aa0e0b8",
            Name : "John Doe",
            Email : "john.doe@email.com"
         },
         {
            Id : "9ec0eb5f-00f4-46d4-809f-dc3f7aa0e0b8",
            Name : "Jane Doe",
            Email : "jane.doe@email.com"
         }
      ],
      Setting : {
         Id : "28b689a9-27a9-4ca2-a5a7-d280fea95a1f",
         Phone : "00-123 123"
      }
   }
}

This data may be accessed from a page template. To print out the Phone property from the Settings object in this Handlebars syntax may be used:

{{Data.Setting.Phone}}

To print out all the names of the persons in the state object the following Handlebars syntax may be used:

{{#each Data.Persons}}
   {{Name}}

{{/each}}