我想在用纯JS编写的Angular 2代码中使用ViewEncapsulation.Native,即ES5。但它给出了未定义的。如何在 es5 中访问它?
您可以尝试以下操作:
var AppComponent = ng.core
.Component({
selector: 'my-app',
template: '<div>Test</div>',
viewEncapsulation: ng.core.ViewEncapsulation.Native
})
.Class({
constructor: function () {
(...)
}
});