我知道这个问题已经发布了很多次,但不是针对角度7的问题。似乎他们更改了一些内容,因为这样做像此处描述的那样:https://stackoverflow.com/a/51256389/1056512不再起作用。 这是代码:
import { Component } from '@angular/core';
export function CustomElement(args: any = {}): (cls: any) => any {
const ngCompDecorator = Component(args);
return function(compType: any) {
ngCompDecorator(compType);
};
}
装饰器使用
@CustomElement({
selector: 'multiple',
templateUrl: './multiple.html',
styleUrls: ['./multiple.scss']
})
我遇到以下错误:Failed to load multiple.html
这是怎么回事?
编辑: 我的软件包依赖项:
"@angular/animations": "~7.2.0", "@angular/common": "~7.2.0", "@angular/compiler": "~7.2.0", "@angular/core": "~7.2.0", "@angular/forms": "~7.2.0", "@angular/platform-browser": "~7.2.0", "@angular/platform-browser-dynamic": "~7.2.0", "@angular/router": "~7.2.0", "core-js": "^2.5.4", "rxjs": "~6.3.3", "tslib": "^1.9.0", "zone.js": "~0.8.26"
Stackblitz运行在7.0.1上,而我的运行在7.2.0上