为什么 Angular Dart 2 ViewEncapsulation 不再接受枚举?
Why is Angular Dart 2 ViewEncpasulation no longer accepting enums?
在 Angular Dart 2 Alpha 35 中,@view 组件接受了一个枚举值:
@View(
styleUrls: const ["package:tickets/client/components/flight_display/flight_display.css"],
templateUrl: "package:tickets/client/components/flight_display/flight_display.html",
directives: const[CORE_DIRECTIVES],
encapsulation: ViewEncapsulation.NONE
)
封装:ViewEncapsulation.NONE
现在抛出以下错误:
Error:(11, 18) Arguments of a constant creation must be constant
expressions
问题:
将值从枚举传递到 ViewEncapsulation 对象的推荐方法是什么?
上下文
这是 Angular.Dart 2 库的枚举:
enum ViewEncapsulation {
/**
* Emulate scoping of styles by preprocessing the style rules
* and adding additional attributes to elements. This is the default.
*/
Emulated,
/**
* Uses the native mechanism of the renderer. For the DOM this means creating a ShadowRoot.
*/
Native,
/**
* Don't scope the template nor the styles.
*/
None
}
在const[CORE_DIRECTIVES]
之后少了一个,
(由https://github.com/angular/angular/issues/4169#issuecomment-140011891找到),ViewEncapsulation.NONE应该是ViewEncapsulation.None
@View(
styleUrls: const ["package:tickets/client/components/flight_display/flight_display.css"],
templateUrl: "package:tickets/client/components/flight_display/flight_display.html",
directives: const[CORE_DIRECTIVES],
encapsulation: ViewEncapsulation.None
)
在 Angular Dart 2 Alpha 35 中,@view 组件接受了一个枚举值:
@View(
styleUrls: const ["package:tickets/client/components/flight_display/flight_display.css"],
templateUrl: "package:tickets/client/components/flight_display/flight_display.html",
directives: const[CORE_DIRECTIVES],
encapsulation: ViewEncapsulation.NONE
)
封装:ViewEncapsulation.NONE
现在抛出以下错误:
Error:(11, 18) Arguments of a constant creation must be constant
expressions
问题: 将值从枚举传递到 ViewEncapsulation 对象的推荐方法是什么?
上下文
这是 Angular.Dart 2 库的枚举:
enum ViewEncapsulation {
/**
* Emulate scoping of styles by preprocessing the style rules
* and adding additional attributes to elements. This is the default.
*/
Emulated,
/**
* Uses the native mechanism of the renderer. For the DOM this means creating a ShadowRoot.
*/
Native,
/**
* Don't scope the template nor the styles.
*/
None
}
在const[CORE_DIRECTIVES]
之后少了一个,
(由https://github.com/angular/angular/issues/4169#issuecomment-140011891找到),ViewEncapsulation.NONE应该是ViewEncapsulation.None
@View(
styleUrls: const ["package:tickets/client/components/flight_display/flight_display.css"],
templateUrl: "package:tickets/client/components/flight_display/flight_display.html",
directives: const[CORE_DIRECTIVES],
encapsulation: ViewEncapsulation.None
)