Meteor return URL value as string. (FOUND SOLUTION PLZ CLOSE)


#1

I’m trying to return a URL that I build up in a helper and add it to my href, but its coming back blank. I’m console.logging my final URL and its correct… I"ve tried single quotes, double and tripple {{{myhelper}}}. But it returns blank and removes the HREF attribute altogether???

my .html within a loop, passes the row.

<td class="table__cell">
    <a href={{ buildUCDLink row }} >go</a>
</td>

my .js helper

buildUCDLink(process){
  const thisTemplate = Template.instance();
  const integrations = thisTemplate.integrations.get();
  integrations.forEach((integration) => {
   if (integration._id._str === process.integration_id._str ) {
     const finalUcdUrl = integration.ucd_url + '/#applicationProcessRequest/' + process.id;
     console.log('finalUcdUrl: ', finalUcdUrl);  //<-- this is correct...
    return finalUcdUrl;
  }
});

},

it didn’t like my var in my loop for whatever reason. When I added a let and reassigned it returned correctly.

buildUCDLink(process){
    const thisTemplate = Template.instance();
    const integrations = thisTemplate.integrations.get();
    let returnURL = '';
    integrations.forEach((integration) => {
      if (integration._id._str === process.integration_id._str ) {
        const finalUcdUrl = integration.ucd_url + '/#applicationProcessRequest/' + process.id;
        returnURL = finalUcdUrl;
      }
    });
    return returnURL;
  },