說明
Description
為了使 Angular 編譯器中的元資料提取更快,裝飾器 @NgModule
、@Pipe
、@Component
、@Directive
和 @Injectable
只能接受物件字面量作為引數。
To make the metadata extraction in the Angular compiler faster, the decorators @NgModule
, @Pipe
, @Component
, @Directive
, and @Injectable
accept only object literals as arguments.
這是 Ivy 中的有意更改,與 View Engine 相比,它對裝飾器強制執行更嚴格的引數要求。 Ivy 需要這種方法,因為它透過將表示式移到類別輸出中的其他位置來編譯這些裝飾器。
This is an intentional change in Ivy, which enforces stricter argument requirements for decorators than View Engine. Ivy requires this approach because it compiles decorators by moving the expressions into other locations in the class output.