Question regarding Router

Hi!

I’m testing Fuse doing an app

That’s basicly my code

My main code looks like this:

<App>
	<Router ux:Name="router" />
	<Navigator DefaultTemplate="home">
		<mainNav ux:Template="home" router="router" />
		<detail ux:Template="detail" router="router" />
	</Navigator>
</App>

On mainNav, we have a tabbed navigation

<ClientPanel Dock="Fill" ux:Class="mainNav">
    <Router ux:Dependency="router" />
    <PageControl ux:Name="nav">
      <Page ux:Name="highlights">
        <homeList router="router" />
      </Page>
      <Page ux:Name="others">
        <othersList router="router" />
      </Page>
    </PageControl>
</ClientPanel>

And inside each page we list some items

<Panel Dock="Fill" ux:Class="homeList" columcount="1">
  <int ux:Property="columcount" />
  <Router ux:Dependency="router" />
  <UserEvent Name="routeReceta"/>
  <OnUserEvent EventName="routeReceta" Handler="{routeReceta}" />
  <ScrollView>
    <Panel>
      <JavaScript>
          var Observable = require("FuseJS/Observable");
          var data = Observable();

          fetch('http://myapi.com/list_home')
          .then(function(response) { return response.json(); })
          .then(function(responseObject) {
            data.value = responseObject;
          });

          module.exports = {
              dataSource: data
          };
      </JavaScript>
      <WhileWindowLandscape>
        <Set Target="columcount" Value="2" />
      </WhileWindowLandscape>
      <WhileWindowPortrait>
        <Set Target="columcount" Value="1" />
      </WhileWindowPortrait>
      <ColumnLayout ColumnCount="{Property columcount}" />
      <Each Items="{dataSource.responseData}">
          <itemDisplay />
      </Each>
    </Panel>
  </ScrollView>
</Panel>

On all pages i use a itemDisplay so, the code is on a separated file.

<StackPanel ux:Class="itemDisplay" Background="#fff" Padding="5" Margin="5,5,5,0">
    <UserEvent Name="routeMe"/>
    <OnUserEvent EventName="routeMe" Handler="{routeMe}" />
    <JavaScript>

      var routeMe = function(args) {
        router.push("detail", { id: args.id });
      }

      module.exports = {
        routeMe: routeMe
      }
    </JavaScript>
    <string ux:Property="picture" />
    <string ux:Property="title" />
    <string ux:Property="id" />
    <Image Url="{picture}" StretchMode="UniformToFill" StretchSizing="Natural" Alignment="TopLeft" />
    <Panel Color="#000" Height="45">
      <Text Font="MainView.gothamlight" TextWrapping="Wrap" Value="{title}" FontSize="16"
          Alignment="Center" TextColor="#fff"/>
    </Panel>
    <DropShadow Size="10" Distance="3" Spread="0.05" Color="#0008" Angle="90" />
    <Clicked>
      <RaiseUserEvent EventName="routeMe">
          <UserEventArg Name="id" StringValue="{id}" />
      </RaiseUserEvent>
    </Clicked>
</StackPanel>

But when we click inside my itemDisplay element, y get the following error

LOG: Error: JavaScript call error in recipe-list-item.ux line 6: Name: ReferenceError: router is not defined
    Error message: Uncaught ReferenceError: router is not defined
    File name: itemDisplay.ux
    Line number: 6
    Source line:         			router.push("routeMe", { id: args.id });
    JS stack trace: ReferenceError: router is not defined
        at routeReceta (itemDisplay.ux:6:12)
     in Fuse.Reactive.EventBinding+CallClosure</usr/local/share/uno/Packages/Fuse.Reactive/0.35.8/$.uno:1065>

But if i include the following line on the itemDisplay.ux

<Router ux:Dependency="router" />

It compiles but when it runs, i receive the following error

LOG: System.IndexOutOfRangeException: Index was outside the bounds of the array.
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (System.Object lambda, System.Object[] arguments) <0x156dde20 + 0x000d0> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.CallLambda i) <0x156dcff0 + 0x0004f> in <filename unknown>:0 
      at Outracks.Simulator.Bytecode.Expression.Match[T] (System.Func`2 a1, System.Func`2 a2, System.Func`2 a3, System.Func`2 a4, System.Func`2 a5, System.Func`2 a6, System.Func`2 a7, System.Func`2 a8, System.Func`2 a9, System.Func`2 a10, System.Func`2 a11, System.Func`2 a12, System.Func`2 a13, System.Func`2 a15, System.Func`2 a16) <0x156d4890 + 0x00261> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.Expression expression) <0x156d42f0 + 0x00563> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.ImmutableList`1 arguments) <0x156d4db0 + 0x0005b> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.CallStaticMethod m) <0x156d4d40 + 0x00037> in <filename unknown>:0 
      at Outracks.Simulator.Bytecode.Expression.Match[T] (System.Func`2 a1, System.Func`2 a2, System.Func`2 a3, System.Func`2 a4, System.Func`2 a5, System.Func`2 a6, System.Func`2 a7, System.Func`2 a8, System.Func`2 a9, System.Func`2 a10, System.Func`2 a11, System.Func`2 a12, System.Func`2 a13, System.Func`2 a15, System.Func`2 a16) <0x156d4890 + 0x002ac> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.Expression expression) <0x156d42f0 + 0x00563> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (Outracks.Simulator.Bytecode.Lambda lambda, System.Object[] arguments) <0x156d3e20 + 0x000ff> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.LambdaClosure.Func () <0x156e9ae0 + 0x00040> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.UxTemplate.New () <0x156e9ac0 + 0x00014> in <filename unknown>:0 
      at Fuse.Reactive.Each.AddTemplate (Uno.UX.Template f, System.Collections.Generic.List`1 newElements) <0x1de7f858 + 0x00012> in <filename unknown>:0 
      at Fuse.Reactive.Each.InsertNew (Int32 index) <0x1de7f110 + 0x0018b> in <filename unknown>:0 
      at Fuse.Reactive.Each.AddNew () <0x1de7f0d0 + 0x00023> in <filename unknown>:0 
      at Fuse.Reactive.Each.Repopulate () <0x16fc64e0 + 0x000d3> in <filename unknown>:0 
      at Fuse.Reactive.Each.OnItemsChanged () <0x16fc6130 + 0x001e7> in <filename unknown>:0 
      at Fuse.Reactive.Each.set_Items (System.Object value) <0x1de7f080 + 0x00043> in <filename unknown>:0 
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x4edb718 + 0x0008f> in <filename unknown>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1dff4a38 + 0x0002b> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.TryInvokeExtension.Try (System.Func`1 func) [0x0000d] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Simulator.Runtime/Reflection/CompiledTypeReflection.cs:286 
      at Outracks.Simulator.Runtime.TryInvokeExtension.TryInvoke (System.Reflection.MethodInfo mi, System.Object obj, System.Object[] value) [0x0001b] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Simulator.Runtime/Reflection/CompiledTypeReflection.cs:275 
      at Outracks.Simulator.Runtime.CompiledTypeReflection.SetPropertyValue (System.Object obj, Outracks.Simulator.Bytecode.TypeMemberName propertyName, System.Object value) [0x00032] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Simulator.Runtime/Reflection/CompiledTypeReflection.cs:57 
      at Outracks.Fuse.Preview.RuntimeObjectPoker.<HookUpReflectionInterface>m__2 (System.Object a, System.String b, System.Object c) [0x00000] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Fuse.Preview/RuntimeObjectPoker.cs:29 
      at Outracks.Simulator.Reflection.DelegateReflection.Outracks.Simulator.Runtime.IReflection.SetPropertyValue (System.Object instance, Outracks.Simulator.Bytecode.TypeMemberName propertyName, System.Object value) <0x156e4b80 + 0x0002c> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.WriteProperty p) <0x156e49c8 + 0x00065> in <filename unknown>:0 
      at Outracks.Simulator.Bytecode.Expression.Match[T] (System.Func`2 a1, System.Func`2 a2, System.Func`2 a3, System.Func`2 a4, System.Func`2 a5, System.Func`2 a6, System.Func`2 a7, System.Func`2 a8, System.Func`2 a9, System.Func`2 a10, System.Func`2 a11, System.Func`2 a12, System.Func`2 a13, System.Func`2 a15, System.Func`2 a16) <0x156d4890 + 0x003d8> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.Expression expression) <0x156d42f0 + 0x00563> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (IEnumerable`1 statements) <0x156d41a0 + 0x00077> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (Outracks.Simulator.Bytecode.Lambda lambda, System.Object[] arguments) <0x156d3e20 + 0x00157> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.LambdaClosure.Func (System.Object a1, System.Object a2) <0x15ff3b78 + 0x00086> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.LambdaClosure.Action (System.Object a1, System.Object a2) <0x15ff3b40 + 0x00023> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.UxProperty`1[T].Set (Outracks.Simulator.Runtime.T value, IPropertyListener origin) <0x1de7f020 + 0x00044> in <filename unknown>:0 
      at Fuse.Reactive.DataBinding`1[T].TryPushAsValue (System.Object newValue) <0x1de7ee08 + 0x00197> in <filename unknown>:0 
      at Fuse.Reactive.DataBinding`1[T].PushValue (System.Object newValue) <0x1de7ed38 + 0x00053> in <filename unknown>:0 
      at Fuse.Reactive.DataBinding`1[T].NewValue (System.Object value) <0x1a9fad48 + 0x00085> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandlePath (System.Object dc, System.String path) <0x1bbf0448 + 0x0003a> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandleNewDataContext (System.Object val) <0x1bbf0eb0 + 0x00033> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandleObject (Fuse.Scripting.ObjectMirror obj) <0x1bbf0a18 + 0x00063> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandlePath (System.Object dc, System.String path) <0x1bbf0448 + 0x00443> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandleNewDataContext (System.Object val) <0x1bbf0eb0 + 0x00033> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.OnSet (System.Object value) <0x1de7ed08 + 0x00027> in <filename unknown>:0 
      at Fuse.Scripting.Observable+Set.SendMessage (Fuse.Scripting.Subscription sub) <0x1de715c0 + 0x00034> in <filename unknown>:0 
      at Fuse.Scripting.Observable+Operation.Perform () <0x1de71268 + 0x00077> in <filename unknown>:0 
      at Fuse.Scripting.Context.ProcessUIMessages () <0x16fe1d98 + 0x00043> in <filename unknown>:0 
      at Fuse.UpdateListener.Invoke () <0x1279e5a8 + 0x00053> in <filename unknown>:0 
      at Fuse.UpdateManager.Update (Fuse.Stage stage) <0x1279e070 + 0x0024f> in <filename unknown>:0 
    Index was outside the bounds of the array.
ERROR: Index was outside the bounds of the array.
    System.IndexOutOfRangeException occured.
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (System.Object lambda, System.Object[] arguments) <0x156dde20 + 0x000d0> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.CallLambda i) <0x156dcff0 + 0x0004f> in <filename unknown>:0 
      at Outracks.Simulator.Bytecode.Expression.Match[T] (System.Func`2 a1, System.Func`2 a2, System.Func`2 a3, System.Func`2 a4, System.Func`2 a5, System.Func`2 a6, System.Func`2 a7, System.Func`2 a8, System.Func`2 a9, System.Func`2 a10, System.Func`2 a11, System.Func`2 a12, System.Func`2 a13, System.Func`2 a15, System.Func`2 a16) <0x156d4890 + 0x00261> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.Expression expression) <0x156d42f0 + 0x00563> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.ImmutableList`1 arguments) <0x156d4db0 + 0x0005b> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.CallStaticMethod m) <0x156d4d40 + 0x00037> in <filename unknown>:0 
      at Outracks.Simulator.Bytecode.Expression.Match[T] (System.Func`2 a1, System.Func`2 a2, System.Func`2 a3, System.Func`2 a4, System.Func`2 a5, System.Func`2 a6, System.Func`2 a7, System.Func`2 a8, System.Func`2 a9, System.Func`2 a10, System.Func`2 a11, System.Func`2 a12, System.Func`2 a13, System.Func`2 a15, System.Func`2 a16) <0x156d4890 + 0x002ac> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.Expression expression) <0x156d42f0 + 0x00563> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (Outracks.Simulator.Bytecode.Lambda lambda, System.Object[] arguments) <0x156d3e20 + 0x000ff> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.LambdaClosure.Func () <0x156e9ae0 + 0x00040> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.UxTemplate.New () <0x156e9ac0 + 0x00014> in <filename unknown>:0 
      at Fuse.Reactive.Each.AddTemplate (Uno.UX.Template f, System.Collections.Generic.List`1 newElements) <0x1de7f858 + 0x00012> in <filename unknown>:0 
      at Fuse.Reactive.Each.InsertNew (Int32 index) <0x1de7f110 + 0x0018b> in <filename unknown>:0 
      at Fuse.Reactive.Each.AddNew () <0x1de7f0d0 + 0x00023> in <filename unknown>:0 
      at Fuse.Reactive.Each.Repopulate () <0x16fc64e0 + 0x000d3> in <filename unknown>:0 
      at Fuse.Reactive.Each.OnItemsChanged () <0x16fc6130 + 0x001e7> in <filename unknown>:0 
      at Fuse.Reactive.Each.set_Items (System.Object value) <0x1de7f080 + 0x00043> in <filename unknown>:0 
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x4edb718 + 0x0008f> in <filename unknown>:0 
    --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x1dff4a38 + 0x0002b> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.TryInvokeExtension.Try (System.Func`1 func) [0x0000d] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Simulator.Runtime/Reflection/CompiledTypeReflection.cs:286 
      at Outracks.Simulator.Runtime.TryInvokeExtension.TryInvoke (System.Reflection.MethodInfo mi, System.Object obj, System.Object[] value) [0x0001b] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Simulator.Runtime/Reflection/CompiledTypeReflection.cs:275 
      at Outracks.Simulator.Runtime.CompiledTypeReflection.SetPropertyValue (System.Object obj, Outracks.Simulator.Bytecode.TypeMemberName propertyName, System.Object value) [0x00032] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Simulator.Runtime/Reflection/CompiledTypeReflection.cs:57 
      at Outracks.Fuse.Preview.RuntimeObjectPoker.<HookUpReflectionInterface>m__2 (System.Object a, System.String b, System.Object c) [0x00000] in /usr/local/Teamcity/Agents/tcagent-osx-agent02-teamcity-dyson/work/b939dc4c6ac331f9/Source/Outracks.Fuse.Preview/RuntimeObjectPoker.cs:29 
      at Outracks.Simulator.Reflection.DelegateReflection.Outracks.Simulator.Runtime.IReflection.SetPropertyValue (System.Object instance, Outracks.Simulator.Bytecode.TypeMemberName propertyName, System.Object value) <0x156e4b80 + 0x0002c> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.WriteProperty p) <0x156e49c8 + 0x00065> in <filename unknown>:0 
      at Outracks.Simulator.Bytecode.Expression.Match[T] (System.Func`2 a1, System.Func`2 a2, System.Func`2 a3, System.Func`2 a4, System.Func`2 a5, System.Func`2 a6, System.Func`2 a7, System.Func`2 a8, System.Func`2 a9, System.Func`2 a10, System.Func`2 a11, System.Func`2 a12, System.Func`2 a13, System.Func`2 a15, System.Func`2 a16) <0x156d4890 + 0x003d8> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Evaluate (Outracks.Simulator.Bytecode.Expression expression) <0x156d42f0 + 0x00563> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (IEnumerable`1 statements) <0x156d41a0 + 0x00077> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.ScopeClosure.Execute (Outracks.Simulator.Bytecode.Lambda lambda, System.Object[] arguments) <0x156d3e20 + 0x00157> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.LambdaClosure.Func (System.Object a1, System.Object a2) <0x15ff3b78 + 0x00086> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.LambdaClosure.Action (System.Object a1, System.Object a2) <0x15ff3b40 + 0x00023> in <filename unknown>:0 
      at Outracks.Simulator.Runtime.UxProperty`1[T].Set (Outracks.Simulator.Runtime.T value, IPropertyListener origin) <0x1de7f020 + 0x00044> in <filename unknown>:0 
      at Fuse.Reactive.DataBinding`1[T].TryPushAsValue (System.Object newValue) <0x1de7ee08 + 0x00197> in <filename unknown>:0 
      at Fuse.Reactive.DataBinding`1[T].PushValue (System.Object newValue) <0x1de7ed38 + 0x00053> in <filename unknown>:0 
      at Fuse.Reactive.DataBinding`1[T].NewValue (System.Object value) <0x1a9fad48 + 0x00085> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandlePath (System.Object dc, System.String path) <0x1bbf0448 + 0x0003a> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandleNewDataContext (System.Object val) <0x1bbf0eb0 + 0x00033> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandleObject (Fuse.Scripting.ObjectMirror obj) <0x1bbf0a18 + 0x00063> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandlePath (System.Object dc, System.String path) <0x1bbf0448 + 0x00443> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.HandleNewDataContext (System.Object val) <0x1bbf0eb0 + 0x00033> in <filename unknown>:0 
      at Fuse.Reactive.SegmentObserver.OnSet (System.Object value) <0x1de7ed08 + 0x00027> in <filename unknown>:0 
      at Fuse.Scripting.Observable+Set.SendMessage (Fuse.Scripting.Subscription sub) <0x1de715c0 + 0x00034> in <filename unknown>:0 
      at Fuse.Scripting.Observable+Operation.Perform () <0x1de71268 + 0x00077> in <filename unknown>:0 
      at Fuse.Scripting.Context.ProcessUIMessages () <0x16fe1d98 + 0x00043> in <filename unknown>:0 
      at Fuse.UpdateListener.Invoke () <0x1279e5a8 + 0x00053> in <filename unknown>:0 
      at Fuse.UpdateManager.Update (Fuse.Stage stage) <0x1279e070 + 0x0024f> in <filename unknown>:0 

As i can see, it’s a recursion problem with the Dependency.

How can i have a router inside my itemDisplayElement?

Any idea will be appreciated.

Regards

John

Another thing that i tried and also not work

<StackPanel ux:Class="itemDisplay" Background="#fff" Padding="5" Margin="5,5,5,0">
    <Router ux:Property="router" />
    <UserEvent Name="routeMe"/>
    <OnUserEvent EventName="routeMe" Handler="{routeMe}" />
    <JavaScript>

      var routeMe = function(args) {
        router.push("detail", { id: args.id });
      }

      module.exports = {
        routeMe: routeMe
      }
    </JavaScript>
    <string ux:Property="picture" />
    <string ux:Property="title" />
    <string ux:Property="id" />
    <Image Url="{picture}" StretchMode="UniformToFill" StretchSizing="Natural" Alignment="TopLeft" />
    <Panel Color="#000" Height="45">
      <Text Font="MainView.gothamlight" TextWrapping="Wrap" Value="{title}" FontSize="16"
          Alignment="Center" TextColor="#fff"/>
    </Panel>
    <DropShadow Size="10" Distance="3" Spread="0.05" Color="#0008" Angle="90" />
    <Clicked>
      <RaiseUserEvent EventName="routeMe">
          <UserEventArg Name="id" StringValue="{id}" />
      </RaiseUserEvent>
    </Clicked>
</StackPanel>

And i call this way the itemDisplay

    <itemDisplay router="router" />

But i get the same “Error message: Uncaught ReferenceError: router is not defined”

Any idea would be really appreciated

Regards

John

I just realize my mistake!

I have defined the user event inside the itemDisplay and i should have defined it on the main navigation file, like this:

<App>
    <Router ux:Name="router" />
    <UserEvent Name="routeMe"/>
    <OnUserEvent EventName="routeMe" Handler="{routeMe}" />
    <JavaScript>

      var routeMe = function(args) {
        router.push("detail", { id: args.id });
      }

      module.exports = {
        routeMe: routeMe
      }
    </JavaScript>
    <Navigator DefaultTemplate="home">
        <mainNav ux:Template="home" router="router" />
        <detail ux:Template="detail" router="router" />
    </Navigator>
</App>

Doing this, now the event works perfect!

I hope it will help another who made the same mistake

John