【发布时间】:2017-05-01 09:03:18
【问题描述】:
背景
我有一个 Angular2 应用程序,它的可访问性很重要。当无线电输入具有相同名称但未包含在 radiogroup 元素中时,我正在使用的可访问性评估器会抱怨。但是当我放一个radiogroup 元素时,Angular2 给出了模板解析错误:
Unhandled Promise rejection: Template parse errors:
'radiogroup' is not a known element:
1. If 'radiogroup' is an Angular component, then verify that it is part of this module.
2. If 'radiogroup' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("
<div>
[ERROR ->]<radiogroup>
<input type="radio" name="foo id="true" label="True" value="true" />
<in"): App@2:6 ; Zone: <root> ; Task: Promise.then ; Value: Error:
守则
import { Component } from '@angular/core';
@Component({
selector: 'my-component',
template: `
<radiogroup>
<input type="radio" name="my-radio" value="true" />True
<input type="radio" name="my-radio" value="false" />False
</radiogroup>
`
})
export class MyComponent {};
我已将FormsModule 导入到模块中。
【问题讨论】:
-
请为 angular2 npmjs.com/package/ng2-radio-group找到一个无线电组模块。
标签: angular angular2-template radio-group