0

我正在使用useraccounts:ionic包为我的应用程序注册,该包在内部使用useraccounts:core

我创建了包含三个字段Full NameEmailPassword的表单。在默认注册表单中,全名字段不存在,所以,我这样添加,

AccountsTemplates.addField({
    _id: 'fullname',
    type: 'text',
    displayName: "Full Name",
    required: true
});

而且我不想要确认密码。所以,删除了它。

AccountsTemplates.configure({
    confirmPassword: false,
    ....
});

但现在我要重新排列字段。IE

 |=====================|
 |     Full Name       |
 |=====================|
 |       Email         |
 |=====================|
 |      Password       |
 |=====================|

在通过meteor-useraccounts/core Guide之后。

这是我的代码:

var pwd = AccountsTemplates.removeField('password');
var email = AccountsTemplates.removeField('email');

AccountsTemplates.addField([
    {
        _id: 'fullname',
        type: 'text',
        displayName: "Full Name",
        required: true
    },
    email,
    pwd
]);

它向我扔了这个error

Exception in template helper: TypeError: Cannot read property 'form' of undefined

这是我在MeteorPad的代码

4

1 回答 1

0

按以下顺序尝试

AccountsTemplates.addField({
  _id: 'fullname',
  type: 'text',
  displayName: "Full name",
  placeholder: {
    signUp: "Full name"
  },
  required: true,
  minLength: 1,
  trim: true
});

var email = AccountsTemplates.removeField('email');

AccountsTemplates.addField(email);

var password = AccountsTemplates.removeField('password');

AccountsTemplates.addField(password);

这对我有用

于 2015-08-17T10:20:27.440 回答