我需要将app.component.ts中的选择器名称(选择器:'app-root')更改为其他名称。
让它成为选择器:'new-selector'。
表明,
错误:“选择器”新选择器“与任何元素都不匹配”
当选择器名称发生更改时,所有文件都会受到影响?怎么解决?
如果更改app.component.ts的选择器名称
然后你需要在index.html中更改它
from <app-root> </app-root>
to <new-selector> </new-selector>
必须进行的更改包括:
HTML:
<app-root> to <new-selector>
Component.ts:
@Component {
selector: 'new-selector' //change here from app-root to new-selector
}
希望有所帮助!!如果没有,请分享一个关于stackblitz的工作示例