Angular-Formly:如何在字段中输入-sm class

Angular-Formly: How to put an input- sm class in field

如何使用 angular-formly 在字段中设置一个 class 之类的 .input-sm?

例如:

<input class="form-control input-sm" name="test" type="text" placeholder=".input-sm">

Here you go。只需使用 ngModelElAttrs 属性:

{
  key: 'yourKey',
  type: 'input',
  ngModelElAttrs: {
    class: 'form-control input-sm' // <-- this is it!
  },
  templateOptions: {
    label: 'Input'
  }
}