To be very clear, you need to remove the <Page>
wrapper around your <Notes>
and let the <Notes>
component be a direct child of the <Navigator>
. The navigator sends the parameter only to its direct child.
I changed my “page” code to this, base on the hikr source code and still nothing showing on the
<text value="{id}"/>
I don’t think I follow completely your suggestion
Don’t change your page, change the navigator setup. It needs to look like this:
<Navigator>
<CalendarControl ux:Template="firstPage" router="router" />
<Calendar ux:Template="secondPage" router="router" />
<Notes ux:Template="thirdPage" router="router" />
<Settings ux:Template="fourthPage" router="router" />
</Navigator>
```
Ok… I figure it out and removed the tag from the Navigator and I do see the data.
But… How can I see this data inside a .js file?
Example
console.log(passed-data-variable);
You can’t do that synchronously, you have to subscribe to changes:
this.Parameter.onValueChanged(module, function(p) {
console.log(p);
});
I did this and seems to work fine.
id.subscribe(module);
console.log(id.value);
I’m getting the value from the passed data.
Thanks for the patience and help. Sorry for giving you such a hard time.
That approach may work sometimes, but it’s not guaranteed to work for observables where the data arrives asynchronously (e.g. from a HTTP call).
No problem, it’s good to know what things users find difficult so we can improve documentation and examples.
What can i use instead of the subscribe(module)
approach?
I just saw that it only give me data when i reset the app.
I just explained what you need to use in my previous post: .onValueChanged(module, function(p) { ..
var Timer = require("FuseJS/Timer"); //trying to use this to get data fast
var tt = this.Parameter;
var wd = tt.map(function(x) {
return x.wd;
});
Timer.create(function(){ //<-- this call only works once after restarting the app preview
getP(); //
},300,false);
function getP(){ //<- this one works every time but only when clicked on a button inside the view
console.log(wd.value);
}
module.exports = {
wd:wd,
getP:getP
}
Some findings…
Anders Lassen wrote:
I just explained what you need to use in my previous post:
.onValueChanged(module, function(p) { ..
I forgot about this one.
Thanks again.
This is for anyone that has the same issue:
This worked for me:
this.Parameter.onValueChanged(module,function(x){
Timer.create(function(){
getP();
},300,false);
});
function getP(){
console.log(wd.value);
}
I’m getting the value constantly on the view and also on the .js file where some processing is going to be done.
Thanks again for the support…!!