Dart Angular Components Validator示例

时间:2017-10-30 15:35:20

标签: angular dart components

您好我正在使用Dart Angular Components。我尝试在代码中使用数字验证器:   MaterialNumberValidator,   PositiveNumValidator,   CheckNonNegativeValidator,   UpperBoundValidator 你能举例说明如何在实践中使用它们。

在组件中我添加了:

@Component(
   ...
  directives: const [
    CORE_DIRECTIVES,
    materialNumberInputDirectives,
    materialDirectives
  ],
  providers: const [NG_VALIDATORS]
)

在模板中我有。

  <material-input label="What do you need to do?"
                  autoFocus floatingLabel style="width:80%"
                  [(ngModel)]="newTodo"
                  (keyup.enter)="add()"
                  type="number"
                  checkInteger
                  checkPositive
                  >
  </material-input>

但它不起作用。

0 个答案:

没有答案