1
我有兩個角2組件,<future-todos>
和<past-todos>
。我可以以某種方式動態加載它們,如下所示?是否可以通過動態更改其選擇器名稱加載Angular 2組件?
component.ts
if (condition) {
list = 'future';
} else {
list = 'past';
}
component.html
<{{list}}-todos></{{list}}-todos>
我的實際情況更復雜,我省略了大量的代碼,以簡化表示本實例我需要。
不要錯過這個[我如何使用/創建動態模板來編譯動態組件與Angular 2.0?](http://stackoverflow.com/q/38888008/1679310) –