I would like to follow what explained in this post to display a header only on the sub pages. But how do I set a global boolean Observable?
You put the variable in a separate JS module that you require()
from your viewmodels. As an example:
Modules/Common.js
:
var Observable = require("FuseJS/Observable");
var bool = Observable(false);
module.exports = {
bool: bool
};
SomePage.ux
:
<JavaScript>
var Common = require("Modules/Common");
module.exports = {
theGlobalBool: Common.bool
};
</JavaScript>
<WhileTrue Value="{theGlobalBool}">
<!-- ... -->
</WhileTrue>
And don’t forget to add "Modules/*.js:Bundle"
to your .unoproj
file.
1 Like
Done! perfect.