Angular 4 字形图标的模板绑定
Angular 4 template binding for glyph icons
我正在尝试使用开放式标志性图标,但是一旦我尝试将图标名称动态设置为数据字形属性,它就会崩溃
错误是:
Uncaught Error: Template parse errors:
Can't bind to 'glyph' since it isn't a known property of 'span'. ("
<span class="oi" [ERROR ->]data-glyph="{{value}}" title="icon name" aria-hidden="true"></span>
"): ng:///AppModule/ImageButtonComponent.html@1:17
模板部分:
<span class="oi" data-glyph="{{value}}" title="icon name" aria-hidden="true"></span>
你可以用这个:
<span [attr.data-glyph]="value"></span>
Plunkr 示例可用 here。
我正在尝试使用开放式标志性图标,但是一旦我尝试将图标名称动态设置为数据字形属性,它就会崩溃 错误是:
Uncaught Error: Template parse errors:
Can't bind to 'glyph' since it isn't a known property of 'span'. ("
<span class="oi" [ERROR ->]data-glyph="{{value}}" title="icon name" aria-hidden="true"></span>
"): ng:///AppModule/ImageButtonComponent.html@1:17
模板部分:
<span class="oi" data-glyph="{{value}}" title="icon name" aria-hidden="true"></span>
你可以用这个:
<span [attr.data-glyph]="value"></span>
Plunkr 示例可用 here。