Last active
November 27, 2015 21:20
-
-
Save Nepoxx/b1677ea30b2fdf411c57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
config.map([ | |
{route: ['arraytest', 'arraytest/:test'], name: 'test', moduleId: 'arraytest/arraytest', title: 'test'} | |
]); | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div repeat.for="val of values">${val}</div> | |
<a if.bind="pathParam" href="#/arraytest">go to pure route</a> | |
<a if.bind="!pathParam" href="#/test/arraypathparam">go to pathParam route</a> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ArrayTest { | |
values = []; | |
pathParam = false; | |
constructor() { | |
this.values = []; | |
} | |
activate(pathParams) { | |
this.values.length = 0; // I tried adding it here, doesn'T help | |
if (pathParams && pathParams.test) { | |
this.values.push('Path param route') | |
this.pathParam = true; | |
} else { | |
this.values.push('Pure route') | |
this.pathParam = false; | |
} | |
console.log('values', values); // Here the array will only ever have 1 value in it. yes the HTML shows many | |
} | |
deactivate() { | |
this.values.length = 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment