I do not use typescript, but I use ES6. May be useful for you.
The way I solve this is to declare pattern strings using `` quotes. This works great for me, I would love to know if anyone thinks this is a bad habit.
below snippet with Angular (- ui-router).
index.js
var indexTemplate = ` <div> <h1>{{ Index page }}</h1> </div ` export {indexTemplate}
config.js
import { indexTemplate } from './index.js' function config($stateProvider){ $stateProvider.state('index', { url: '/', controller: 'indexController', template: indexTemplate }) }
For completeness, this assumes that the indexController is defined elsewhere. In addition, this configuration function is exported to the place where the application is defined. But all this is not related to the issue.
Maurits Moeys
source share