相关疑难解决方法(0)

将自定义元素和属性添加到编译器架构

组件模板中有一些自定义元素和属性(在此示例中,第三方非角度代码使用了它们):

<foo></foo>
<div data-bar="{{ bar }}"></div>
Run Code Online (Sandbox Code Playgroud)

它们会导致编译器错误:

Template parse errors:
'foo' is not a known element:
1. If 'foo' is an Angular component, then verify that it is part of this module.
2. If 'foo' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
    [ERROR ->]<foo></foo>
    <div data-bar="{{ bar }}"></div>
  "): App@1:4
Can't bind to 'bar' since it isn't a known property of 'div'. ("
    <foo></foo>
    <div [ERROR ->]data-bar="{{ bar }}"></div> …
Run Code Online (Sandbox Code Playgroud)

angular2-compiler angular4 angular

3
推荐指数
1
解决办法
746
查看次数

标签 统计

angular ×1

angular2-compiler ×1

angular4 ×1