3

我不知道如何以角度形式给出 xeditable 的 e-ng-options。

这是正式的配置:

     formlyConfig.setType({
          extends: 'select',
          template: '<div><span editable-select="model[options.key]" e-ng-options="" e-name="{{::id}}">{{ model[options.key] || "empty" }}</span></div>',
          name: 'editableSelect'
        });

这是选择值:

    {
        className: 'col-xs-12 col-sm-6',
        type: 'editableSelect',
        key: 'gender',
        templateOptions: {
          label: 'Gender',
          options: [
        {name: 'Male', value: 'male'},
        {name: 'Female', value: 'female'}]
        }
     }

请看JSBIN

4

1 回答 1

3

我刚刚想通了。

formlyConfig.setType({
      extends: 'select',
      template: '<div><span editable-select="model[options.key]" e-ng-options="s.value as s.name for s in {{options.templateOptions.options}}" e-name="{{::id}}" e-placeholder="{{options.templateOptions.placeholder}}">{{ model[options.key] || "empty" }}</span></div>',
      name: 'editableSelect'
});

引用xeditable

于 2015-11-06T09:23:18.800 回答