The template is not aware of the email template that is calling it.
If your template needs to look differently based on the e-mail, you need to use 2 templates for 2 different emails.
I mean instead of using in both of them
{{layout handle="some_handle_here"}}
in both of them, you need to use in the section one something like this:
{{layout handle="some_other_handle_here"}}
and create the new layout handle in one of your layout files and use a different template file.
Email Template in magento work based on 2 values.
your template must be there in xml file OR in database.
For the first approach, You need to define and create your own email template for this in your custom module .for example etc/email_templates.xml
from Module module-email
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd">
<template id="design_email_header_template" label="Header" file="header.html" type="html" module="Magento_Email" area="frontend"/>
<template id="design_email_footer_template" label="Footer" file="footer.html" type="html" module="Magento_Email" area="frontend"/>
</config>
and template under module-email/view/frontend/email
OR
i have checked by dirty trick
Create new template from admin panel and grab value of id
(increment id)
after that inserted entry in core_config_data
INSERT INTO `core_config_data` (`config_id`, `scope`, `scope_id`, `path`, `value`) VALUES (NULL, 'default', '0', 'design/email/footer-invoice_template', 'increment id');
in above case i have added increment id
as 2 which is template id from DB which i have created
now you can place your template in any email
{{template config_path="design/email/footer-invoice_template"}}
it should work.
Best Answer
First of all add mage/url to the list of dependencies. Then add the below function to your js file.
Then use the knockout to set href
Then must clear the varnish and browser cache and check