Is it possible to put a varible(or a const) to the path instead of writting whole path as string literal. As it seems, angular doesn't accept anything but string literal.
import aClass = require("./simpleClass");
import { aComponent } from aClass.myClass.Root + 'tutorial.component';
myClass:
export class myClass{
public static Root = "./"
}
In this example aClass.myClass.Root + 'tutorial.component' has error which was explained
it does support dynamic imports now..
just do this
async () => {
const { aComponent } = await import(aClass.myClass.Root + 'tutorial.component');
}
for more information
http://2ality.com/2017/01/import-operator.html
Try this
import aClass from "./simpleClass";
var aComponent = require(aClass.myClass.Root + 'tutorial.component').aComponent;
or
import { myClass } from './simpleClass';
const { aComponent } = require(myClass.Root + 'tutorial.component');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With