Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我写了如下代码
this._renderer.appendChild(document.body, form);
这工作正常。但我直接访问document.body. 是否有角度 2/4 的访问方式document.body?
document.body
您可以通过DOCUMENT注入令牌注入。这将以documentAngular 方式为您提供对象(如您所说)。
DOCUMENT
document
constructor(@Inject(DOCUMENT) private document: Document)