Skip to main content
added 1 character in body
Source Link
powerbuoy
  • 12.8k
  • 8
  • 49
  • 81

I'm trying to dynamically generate a route-href in a list of items. I basically have this:

this.items = [
    {
        name: 'Foo',
        route: 'item',
        routeParams: {
            id: 1
        }
    },
    {
        name: 'Bar',
        route: 'item',
        routeParams: {
            id: 2
        }
    }
];

And in my view:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind: ${item.routeParams}">
            ${item.name}
        </a>
    </li>
</ul>

But Aurelia tells me:

aurelia-logging-console.js:54 ERROR [route-href] Error: A route with name 'undefined' could not be found. Check that `name: 'undefined'` was specified in the route's config

If I print the ${item.route} and ${item.routeParams} they do contain the correct values:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=$bind: ${item.routeParams}">
            ${item.name} ${item.route} ${item.routeParams}
        </a>
    </li>
</ul>

Why? :/

I'm trying to dynamically generate a route-href in a list of items. I basically have this:

this.items = [
    {
        name: 'Foo',
        route: 'item',
        routeParams: {
            id: 1
        }
    },
    {
        name: 'Bar',
        route: 'item',
        routeParams: {
            id: 2
        }
    }
];

And in my view:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind: ${item.routeParams}">
            ${item.name}
        </a>
    </li>
</ul>

But Aurelia tells me:

aurelia-logging-console.js:54 ERROR [route-href] Error: A route with name 'undefined' could not be found. Check that `name: 'undefined'` was specified in the route's config

If I print the ${item.route} and ${item.routeParams} they do contain the correct values:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=${item.routeParams}">
            ${item.name} ${item.route} ${item.routeParams}
        </a>
    </li>
</ul>

Why? :/

I'm trying to dynamically generate a route-href in a list of items. I basically have this:

this.items = [
    {
        name: 'Foo',
        route: 'item',
        routeParams: {
            id: 1
        }
    },
    {
        name: 'Bar',
        route: 'item',
        routeParams: {
            id: 2
        }
    }
];

And in my view:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind: ${item.routeParams}">
            ${item.name}
        </a>
    </li>
</ul>

But Aurelia tells me:

aurelia-logging-console.js:54 ERROR [route-href] Error: A route with name 'undefined' could not be found. Check that `name: 'undefined'` was specified in the route's config

If I print the ${item.route} and ${item.routeParams} they do contain the correct values:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind: ${item.routeParams}">
            ${item.name} ${item.route} ${item.routeParams}
        </a>
    </li>
</ul>

Why? :/

added 1 character in body
Source Link
powerbuoy
  • 12.8k
  • 8
  • 49
  • 81

I'm trying to dynamically generate a route-href in a list of items. I basically have this:

this.items = [
    {
        name: 'Foo',
        route: 'item',
        routeParams: {
            id: 1
        }
    },
    {
        name: 'Bar',
        route: 'item',
        routeParams: {
            id: 2
        }
    }
];

And in my view:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=$bind: ${item.routeParams}">
            ${item.name}
        </a>
    </li>
</ul>

But Aurelia tells me:

aurelia-logging-console.js:54 ERROR [route-href] Error: A route with name 'undefined' could not be found. Check that `name: 'undefined'` was specified in the route's config

If I print the ${item.route} and ${item.routeParams} they do contain the correct values:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=${item.routeParams}">
            ${item.name} ${item.route} ${item.routeParams}
        </a>
    </li>
</ul>

Why? :/

I'm trying to dynamically generate a route-href in a list of items. I basically have this:

this.items = [
    {
        name: 'Foo',
        route: 'item',
        routeParams: {
            id: 1
        }
    },
    {
        name: 'Bar',
        route: 'item',
        routeParams: {
            id: 2
        }
    }
];

And in my view:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=${item.routeParams}">
            ${item.name}
        </a>
    </li>
</ul>

But Aurelia tells me:

aurelia-logging-console.js:54 ERROR [route-href] Error: A route with name 'undefined' could not be found. Check that `name: 'undefined'` was specified in the route's config

If I print the ${item.route} and ${item.routeParams} they do contain the correct values:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=${item.routeParams}">
            ${item.name} ${item.route} ${item.routeParams}
        </a>
    </li>
</ul>

Why? :/

I'm trying to dynamically generate a route-href in a list of items. I basically have this:

this.items = [
    {
        name: 'Foo',
        route: 'item',
        routeParams: {
            id: 1
        }
    },
    {
        name: 'Bar',
        route: 'item',
        routeParams: {
            id: 2
        }
    }
];

And in my view:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind: ${item.routeParams}">
            ${item.name}
        </a>
    </li>
</ul>

But Aurelia tells me:

aurelia-logging-console.js:54 ERROR [route-href] Error: A route with name 'undefined' could not be found. Check that `name: 'undefined'` was specified in the route's config

If I print the ${item.route} and ${item.routeParams} they do contain the correct values:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=${item.routeParams}">
            ${item.name} ${item.route} ${item.routeParams}
        </a>
    </li>
</ul>

Why? :/

Source Link
powerbuoy
  • 12.8k
  • 8
  • 49
  • 81

Dynamically generated route-href throws error

I'm trying to dynamically generate a route-href in a list of items. I basically have this:

this.items = [
    {
        name: 'Foo',
        route: 'item',
        routeParams: {
            id: 1
        }
    },
    {
        name: 'Bar',
        route: 'item',
        routeParams: {
            id: 2
        }
    }
];

And in my view:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=${item.routeParams}">
            ${item.name}
        </a>
    </li>
</ul>

But Aurelia tells me:

aurelia-logging-console.js:54 ERROR [route-href] Error: A route with name 'undefined' could not be found. Check that `name: 'undefined'` was specified in the route's config

If I print the ${item.route} and ${item.routeParams} they do contain the correct values:

<ul>
    <li repeat.for="item of items">
        <a route-href="route: ${item.route}; params.bind=${item.routeParams}">
            ${item.name} ${item.route} ${item.routeParams}
        </a>
    </li>
</ul>

Why? :/