Angularjs 不';是否以角度显示自定义模板?

Angularjs 不';是否以角度显示自定义模板?,angularjs,angular-formly,Angularjs,Angular Formly,这正在使用,我创建了多个复选框模板,如下所示: <script type="text/ng-template" id="multi-checkbox-template.html"> <div class="radio-group" ng-class="{'has-error': options.formControl.$invalid}"> <label class="control-label"> {{options

这正在使用,我创建了多个复选框模板,如下所示:

    <script type="text/ng-template" id="multi-checkbox-template.html">
<div class="radio-group"
     ng-class="{'has-error': options.formControl.$invalid}">
    <label class="control-label">
        {{options.label}}
        {{options.required ? '*' : ''}}
    </label>
    <div class="radio"
         ng-repeat="(key, option) in options.options">
        <label>
            <input type="checkbox"
                   formly-dynamic-name="id + '_'+ $index"
                   formly-custom-validation="options.validators"
                   id="{{id + '_'+ $index}}"
                   aria-describedby="{{id}}_description"
                   ng-value="option.value"
                   ng-required="options.required"
                   ng-model="$parent.model[$parent.options.key || $parent.index][option.name]">
            {{option.name}}
        </label>
        <p id="{{id}}_description"
           class="help-block"
           ng-if="option.description">
            {{option.description}}
        </p>
    </div>
</div>
</script>
这是控制器:

{
            "key": "Q2",
            "type":'multi-checkbox',
             "templateOptions": {
             "label": "What languages are you familiar with?",
             "options": [
                {                    {
                  "name": "spanish",
                  "value": "spnsh"
                },
                {
                  "name": "french",
                  "value": "frnch"
                },
                {
                  "name": "more",
                  "value": "more"
                }
              ]
            }

          }
        ];
问题是,即使出现错误,也不会显示任何内容。我知道关于服务器响应的路径是正确的 `GET/multi-checkbox-template.html 200 1ms 这是我得到的警告

angular-formly-bootstrap formly-field apiCheck failed! Required `label` not specified in `Argument 1/value/templateOptions`. Must be `String`  https://github.com/formly-js/angular-formly/blob/6.10.0/other/ERRORS_AND_WARNINGS.md#formly-field-type-apicheck-failed

You passed:
{
  "key": "Q2",
  "type": "multi-checkbox",
  "templateOptions": {
    "to.label": "In what languages does your firm provide live chat support?",
    "to.options": [
      {
        "name": "english",
        "value": "eng"
      },
      {
        "name": "spanish",
        "value": "spnsh"
      },
      {
        "name": "french",
        "value": "frnch"
      },
      {
        "name": "more",
        "value": "more"
      }
    ]
  },
  "$$hashKey": "object:592",
  "data": {},
  "validation": {
    "messages": {}
  },
  "id": "formly_1_multi-checkbox_Q2_5"
}

With the types:
{
  "key": "string",
  "type": "string",
  "templateOptions": {
    "to.label": "string",
    "to.options": {
      "0": {
        "name": "string",
        "value": "string"
      },
      "1": {
        "name": "string",
        "value": "string"
      },
      "2": {
        "name": "string",
        "value": "string"
      },
      "3": {
        "name": "string",
        "value": "string"
      }
    }
  },
  "$$hashKey": "string",
  "data": "Object",
  "validation": {
    "messages": "Object"
  },
  "value": "Function",
  "runExpressions": "Function",
  "resetModel": "Function",
  "updateInitialValue": "Function",
  "id": "string",
  "initialValue": "undefined"
}

The API calls for:
{
  "__apiCheckData": {
    "strict": false,
    "optional": false,
    "type": "shape"
  },
  "shape": {
    "templateOptions": {
      "__apiCheckData": {
        "strict": false,
        "optional": false,
        "type": "shape",
        "error": "THIS IS THE PROBLEM: Required `label` not specified in `templateOptions`. Must be `String`"
      },
      "shape": {
        "label": "String <-- YOU ARE MISSING THIS"
      }
    }
  }
}
angular formly引导formly字段apiCheck失败!“参数1/value/templateOptions”中未指定必需的“label”。必须是'String'https://github.com/formly-js/angular-formly/blob/6.10.0/other/ERRORS_AND_WARNINGS.md#formly-字段类型apicheck失败
你通过了:
{
“密钥”:“Q2”,
“类型”:“多复选框”,
“模板选项”:{
“to.label”:“贵公司以何种语言提供实时聊天支持?”,
“to.options”:[
{
“名称”:“英语”,
“值”:“eng”
},
{
“姓名”:“西班牙语”,
“价值”:“spnsh”
},
{
“名称”:“法语”,
“值”:“frnch”
},
{
“姓名”:“更多”,
“价值”:“更多”
}
]
},
“$$hashKey”:“对象:592”,
“数据”:{},
“验证”:{
“消息”:{}
},
“id”:“formly\u 1\u多复选框\u Q2\u 5”
}
使用以下类型:
{
“键”:“字符串”,
“类型”:“字符串”,
“模板选项”:{
“to.label”:“string”,
“to.options”:{
"0": {
“名称”:“字符串”,
“值”:“字符串”
},
"1": {
“名称”:“字符串”,
“值”:“字符串”
},
"2": {
“名称”:“字符串”,
“值”:“字符串”
},
"3": {
“名称”:“字符串”,
“值”:“字符串”
}
}
},
“$$hashKey”:“字符串”,
“数据”:“对象”,
“验证”:{
“消息”:“对象”
},
“值”:“函数”,
“运行表达式”:“函数”,
“重置模型”:“功能”,
“updateInitialValue”:“函数”,
“id”:“字符串”,
“initialValue”:“未定义”
}
API要求:
{
“uuu apiCheckData”:{
“严”:假,
“可选”:false,
“类型”:“形状”
},
“形状”:{
“模板选项”:{
“uuu apiCheckData”:{
“严”:假,
“可选”:false,
“类型”:“形状”,
“错误”:“这就是问题所在:`templateOptions`中未指定必需的`label`。必须是`String`”
},
“形状”:{

“标签”:“formlyConfigProvider中的字符串模板URL。setType()不是指向文件的目录链接

templateUrl实际上是指脚本标记中的id属性

你应该做的是:

 formlyConfigProvider.setType(
  {
    name: 'multi-checkbox',
    templateUrl: 'custom-template.html'
    wrapper: ['bootstrapLabel', 'bootstrapHasError']
  }
在模板html文件中:

<script type="text/ng-template" id="custom-template.html">
    <!-- your custom template should be here -->
</script>

表单配置提供程序中的templateUrl。setType()不是指向文件的目录链接

templateUrl实际上是指脚本标记中的id属性

你应该做的是:

 formlyConfigProvider.setType(
  {
    name: 'multi-checkbox',
    templateUrl: 'custom-template.html'
    wrapper: ['bootstrapLabel', 'bootstrapHasError']
  }
在模板html文件中:

<script type="text/ng-template" id="custom-template.html">
    <!-- your custom template should be here -->
</script>

表单配置提供程序中的templateUrl。setType()不是指向文件的目录链接

templateUrl实际上是指脚本标记中的id属性

你应该做的是:

 formlyConfigProvider.setType(
  {
    name: 'multi-checkbox',
    templateUrl: 'custom-template.html'
    wrapper: ['bootstrapLabel', 'bootstrapHasError']
  }
在模板html文件中:

<script type="text/ng-template" id="custom-template.html">
    <!-- your custom template should be here -->
</script>

表单配置提供程序中的templateUrl。setType()不是指向文件的目录链接

templateUrl实际上是指脚本标记中的id属性

你应该做的是:

 formlyConfigProvider.setType(
  {
    name: 'multi-checkbox',
    templateUrl: 'custom-template.html'
    wrapper: ['bootstrapLabel', 'bootstrapHasError']
  }
在模板html文件中:

<script type="text/ng-template" id="custom-template.html">
    <!-- your custom template should be here -->
</script>

我认为您对上面的
选项的一些引用应该是指
选项。而不是templateOptions
(您实际上可以将其称为
to
作为快捷方式)。例如,
options.label
options.options
应该是
to.label
to.options
。但不确定这是否是唯一的问题

此外,脚本标记业务对我来说似乎很奇怪,但我总是使用:
template:require('path-to-my-template')
和Webpack,所以我不能确定。

我想你上面提到的
选项应该是指
选项。templateOptions
相反(你可以把它称为
的快捷方式)。例如,
options.label
options.options
应该是
to.label
to.options
。但不确定这是否是唯一的问题

此外,脚本标记业务对我来说似乎很奇怪,但我总是使用:
template:require('path-to-my-template')
和Webpack,所以我不能确定。

我想你上面提到的
选项应该是指
选项。templateOptions
相反(你可以把它称为
的快捷方式)。例如,
options.label
options.options
应该是
to.label
to.options
。但不确定这是否是唯一的问题

此外,脚本标记业务对我来说似乎很奇怪,但我总是使用:
template:require('path-to-my-template')
和Webpack,所以我不能确定。

我想你上面提到的
选项应该是指
选项。templateOptions
相反(你可以把它称为
的快捷方式)。例如,
options.label
options.options
应该是
to.label
to.options
。但不确定这是否是唯一的问题

此外,脚本标记业务对我来说似乎很奇怪,但我总是使用:
template:require('path-to-my-template')
和Webpack,所以我不能确定。

嘿,谢谢你的回复。我已经考虑了你的建议。我仍然有同样的问题,这是我的答案:`
什么