簡體   English   中英

如何在ES5中訪問Component的ViewChildren和ContentChildren?

[英]How to access ViewChildren and ContentChildren of Component in ES5?

是一篇文章,顯示了如何在TypeScript中訪問ViewChildren和ContentChildren。 如果用ES5編寫Angular 2代碼,如何訪問相同內容?

您需要在ng.core.Component的querys屬性中使用ng.core.ViewChildren。

這是示例:

var component = ng.core
    .Component({
        selector: 'comp',
        template: '...',
        (...)
        queries: {
          someProp: new ng.core.ViewChildren(someDirective)
        }
    })
    .Class({
      (...)
    });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM