Angular 架构表单 - 自定义字段

Angular Schema Form - Custom Field

我正在尝试向 angular 架构表单指令添加新的表单字段。文档 (https://github.com/Textalk/angular-schema-form/blob/master/docs/extending.md) 说使用下面的函数调用来做到这一点,

 schemaFormDecoratorsProvider.addMapping(
  'bootstrapDecorator',
  'datepicker',
  'directives/decorators/bootstrap/datepicker/datepicker.html'
);

我是 angularjs 的新手,我不确定从哪里调用这个函数。我尝试了不同的方法,但没有任何效果。有人可以提供一个 jsfiddle 来展示如何做到这一点,或者给我一些提示..

提前致谢。

如示例中的 link ("Ex. from the datepicker add-on"),您需要添加以下 config() 块:

angular.module('schemaForm').config(
['schemaFormProvider', 'schemaFormDecoratorsProvider', 'sfPathProvider',
  function(schemaFormProvider,  schemaFormDecoratorsProvider, sfPathProvider) {

    // Use schemaFormProvider,  schemaFormDecoratorsProvider, sfPathProvider here
    // to configure the custom field
  }
]);

它可以直接添加到您的应用代码的顶层,如下所示:

angular.module('schemaForm').config(...)

var app = angular.module("test", ["schemaForm"]);

app.controller("FormController", function ($scope) {
    $scope.schema = { ... }
    ...
});

更新here is a jsfiddle 证明这一点。