简体   繁体   中英

Angular material components not getting displayed when dynamically loaded

我在 jquery 数据表中使用了 angular 组件,但它没有显示出来。

Can you please supply more data? code? In general, using jQuery with Angular is really not recommended. jQuery runs outside the cycle of Angular and therefor does not update.

if you wanna keep using jQuery you should trigger the change detector ref.

Inject the following in your component constructor

constructor(
    ...
    private cd: ChangeDetectorRef,
    ...
)

after you generate the table, add the following line of code

this.cd.detectChanges();

Again, I highly recommend using angular component & packages only

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM