Page Controller
The sample application contains one page called index.html
and exists in the root of the project directory.
The page controller is the code-behind for the page. In the sample application, the page controller for the index.html
page is index.controller.js
.
The page controller allows components and other DOM elements in HTML on the page to be programmed. It sits between these page elements and the data access layer which exists in the Page Data module.
Page Data Reference
The page data module is imported into the page controller and an instance created on a public property called data
.
DOM References
Public methods on the page controller can be reference directly in HTML using the page
variable set on the global window
object.
Data Binding
The index page uses three Bootstrap components: Input, Select, and Table.
Each of the input components on the page are bound to different properties on the datasource defined in the page data module using the model
configuration property. See component data binding for details on binding components to data.
Validation
Values entered in the input components are required by setting the validate
property and are validated before any calls are made to the query service. See validating components in WireBootstrap for more on validating inputs.
Discover
The Connect button on the page calls the connect
method on the page controller when clicked.
This method gets a list of entities in a database by calling getEntities
on the page data module.
It then binds the list to the Select component by calling _bindEntities
.
Query
When a new entity is selected from the list of entities, a change
event is triggered and the _bindSampleData
function is called.
_bindSampleData
gets an updated dataset that includes the entity in the query and binds it to the Table component.
Last updated