Search code examples
javascriptjqueryaureliafancytree

Aurelia routing links generated by jQuery plugin


Is this possible? I'm trying to add links to nodes in fancy tree, so far i've tried this:

let editText = this.j$('<a route-href="route:' + 'entity' + '; params.bind:{id: '+ node.key +'}"> <span style="padding: 1px 1px; font-size: 10px;">Edit</span></a>');


and later append that string to nodeSpan. It appears as a link on the site, but it doesn't have aurelia-generated classes (such as: 'au-target' or even 'href')

What am I doing wrong?


Solution

  • No, this is not gonna work. The easiest solution I can imagine is generating the link using router.generate, like this:

    let link = this.router.generate('routeName', { id: something });
    let editText = this.j$('<a href="' + link + '"> <span style="padding: 1px 1px; font-size: 10px;">Edit</span></a>');
    

    Anyway, I think you should avoid using jQuery to generate HTML. Use Aurelia features.