Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular AOT生成自定义组件装饰器时出错-5_Angular_Build_Decorator_Angular Aot - Fatal编程技术网

Angular AOT生成自定义组件装饰器时出错-5

Angular AOT生成自定义组件装饰器时出错-5,angular,build,decorator,angular-aot,Angular,Build,Decorator,Angular Aot,我已经构建了一个自定义组件装饰器,如下所述 使用中: @ExtendedComponent({ selector: 'app-auto-complete', }) export class AutoCompleteComponent extends AutoComplete { constructor() { super(); } ngOnInit() { }

我已经构建了一个自定义组件装饰器,如下所述

使用中:

    @ExtendedComponent({
        selector: 'app-auto-complete',
    })
    export class AutoCompleteComponent extends AutoComplete {

        constructor() {
            super();
        }

        ngOnInit() {
        }
    }
它在开发模式下工作得很好,但当我尝试构建它时,会出现以下错误:

    ERROR in : Can't bind to 'suggestions' since it isn't a known         property of 'cds-auto-complete'.
    1. If 'cds-auto-complete' is an Angular component and it has 'suggestions' input, then verify that it is part of this module.
    2. If 'cds-auto-complete' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
    3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("...

我尝试添加自定义元素模式&无错误模式,但没有帮助。关于解决方案有什么想法吗?

像这样的自定义修饰符在AOT中不起作用,因为编译器正在寻找具有@Component修饰符的类。要解决此问题,还必须将@Component decorator添加到类中,并删除自定义decorator中的ComponentextendedConfigtarget:

@Component({...})
@ExtendedComponent({
    selector: 'app-auto-complete',
})
export class AutoCompleteComponent extends AutoComplete {}
但我认为这有点违背了扩展组件的目的


您可以看到完整的github问题。这不是一个完全相同的问题,但原因是相同的

谢谢。我想使用自定义装饰器的主要原因是,我可以使用父外部库组件内联模板。你知道我还有别的办法吗?
@Component({...})
@ExtendedComponent({
    selector: 'app-auto-complete',
})
export class AutoCompleteComponent extends AutoComplete {}