是否可以获得例如changeDetection
属性被定义为给定组件的装饰的一部分?
import { Component, ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'app-banner',
template: '<h1>{{title}}</h1>',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class BannerComponent { }
我试过了:
Reflect.getMetadataKeys(BannerComponent) // []
Reflect.getOwnMetadataKeys(BannerComponent) // []
Reflect.getMetadata('annotations', BannerComponent) // undefined
答案 0 :(得分:0)
看似 hacky 但是无法解决问题:
BannerComponent['__annotations__'][0]