visurel / iconify-angular

Angular implementation of Iconify, strongly inspired from Iconify-React.
19 stars 14 forks source link

Import icon dynamically from module path #7

Closed nguyenhmtriet closed 4 years ago

nguyenhmtriet commented 4 years ago

Hi, How can I show icon from icon module path? Because when importing dynamically it seems not to find that module.

Or maybe with a name icon, will I show it by not import static icon module path. Here is my code

const importIcon = '@iconify/icons-ic/' + item.icon;
const a = import(importIcon).then(icon => {
   console.log(icon);
});

ERROR Error: Uncaught (in promise): Error: Cannot find module '@iconify/icons-ic/twotone-layers' Error: Cannot find module '@iconify/icons-ic/twotone-layers'

visurel commented 4 years ago

Looks like something related to the Angular Build system and not really to the library here.