Router.Push and this.Parameter.onValueChanged not working properly

Hi there!

I have a problem with the deprecation of onParameterChaned event on 1.9. I’m unable to send parameters using router.pushi have a main page with and external js file, and the page what i need to navigate to is on a separate .ux file with another external js file. I have the following code on the main page

var routeContent = function(args) {
   console.log(JSON.stringify(args));
   router.push("content", { id: args.id, title: args.title });
}

And on the external file of the seccond file

this.Parameter.onValueChanged(module, function(param) {
   console.log("ovc: "+JSON.stringify(param));
});

But when i receive the new event this.Parameter.onValueChanged on the seccond external js file i get the value undefined. The ouput looks like this

[Viewport]: {"node":{"external_object":{}},"name":"routeContent","id":"X0298","kind":"content","title":"Sample content"}
[Viewport]: ovc: undefined

Any idea of what i’m doing wrong?

I’ve created a test side project to try to make it work, but i;m getting the same results. You can check the full code here

Thanks

Jonatan

Hello man,

Are you including that JS file using file.js:FuseJS ??

Yes, i"ve tried with the standard include “*”, *js:FuseJS and *js:Bundle, but i get the same result

You have to use :Bundle only okay?
Then do the following on the terminal :
1- fuse kill-all.
2- uno clean.
3- fuse preview

Thanks Ahmed, tried that, but i get the same result. If i can’t fix this, my next step is rolling back to 1.8.1, because i have the app almost complete and this is dragging me out of my deadline :frowning:

I believe that there are many problem on fuse should be fixed :wink:
Go ahead, fix those problem and create Pull-Request against

After pulling my hair for hours, i found an answer on this post that make figureout what was my mistake

<App Background="#263238">
<!-- Global -->
<UserEvent Name="routeContent" />
<OnUserEvent EventName="routeContent" Handler="{routeContent}" />
<JavaScript File="external.js" />
<Router ux:Name="router" />
<Navigator Dock="Fill" DefaultPath="main">
    <Page ux:Template="main">
    <ScrollView>
        <homepage />
    </ScrollView>
    </Page>
    <!-- This call will fire the Parameter.onValueChanged correctly -->
    <content Background="#4266AB" ux:Template="contentPage" />    
    <Page ux:Template="contentPage_b">
        <!-- 
        This call will not, because the parameter is sent to the page contentPage_b and not into the <content> object 
        To make it works, the content shold be direct child of the Navigator object
        -->
        <content Background="#4266AB" />    
    </Page>
</Navigator>
</App>

I was triying to catch the value on a chldren of a page element, but the problem was that the parameter is allways sent directly to the Page. Now it’s working.

Thanks and i hope it will help someone that make this easy mistake

John