I have two UX files: Index
and Search
. Index
has two text fields: From
and To
. They will be used as parameters for Search
screen results.
Search
performs a GET
request to a REST service that retrieves the results in an Observable
variable. Everything is working if I don’t split the files because all the variables is set at the same scope. My problem starts when I separate the files.
What is the correct way to provide these parameters to Search
screen?
An example of the Observable
GET
request:
<JavaScript>
var valueChanged = function (args) {
fetch('http://transport.opendata.ch/v1/locations?from=' + args.data.from + '&to=' + args.data.to)
.then(function(response) { return response.json(); })
.then(function(responseObject) { data.value = responseObject; });
// Uncomment this line below to see the REST output.
// console.log(data.stations);
}
<JavaScript>
And the markup:
<ScrollView>
<StackPanel>
<Each Items="{data.stations}">
<TrainItem />
</Each>
</StackPanel>
</ScrollView>