how to route same file with different data

Back to How-to Discussions

hi.

I want to know how to route same file to same file.

for example, if I have Item.ux file filled with A item data will call it {A page}. and when I choose B item button in {A page}, want to push to B item data filled Item.ux file {B page}. and C,D,E farther

I tired router.push() but wasn't works.

what am I missing here?

Hi!

Its a bit difficult to know what you're trying to do and why your code doesn't work without seing it. Could you post some of your code here?

Did you make your page a ux:Template ?

Hi Hasselknippe

I made it simply.

<App>
    <Router ux:Name="router"/>
    <Navigator DefaultPath="item" >
        <Item ux:Template="item" router="router"/>
        <Item2 ux:Template="item2" router="router"/>
    </Navigator>
</App>

.

    <JavaScript>
        function pushB(){
            router.push("item");
            console.log("go item1 recursive");
        }

        function pushC(){
            router.push("item2");
            console.log("go item2");
        }

        module.exports={
            pushB : pushB,
            pushC : pushC
        }
    </JavaScript>

    <StackPanel>
        <!-- Doesn't work -->
        <Rectangle Fill="Black" Height="100" Width="200" Clicked="{pushB}"/>
        <!-- Works -->
        <Rectangle Fill="Yellow" Height="100" Width="200" Clicked="{pushC}"/>
    </StackPanel>
</Page>

.

thanks

Post Stats
  • 2
    replies
  • 455
    views
  • 2
    users