Custom registration form with Angularjs + Meteor

Asked

Viewed 507 times

0

i am learning recently Angularjs + Meteor, and am doing this tutorial:

http://www.angular-meteor.com/tutorials/socially/angular1/user-accounts-authentication-and-permissions

At this exact step, I’m having trouble customizing the registration form.

The registration that is suggested becomes the directive with simply an email and password, with a default layout. It is completely impossible for me to use this design and this poverty of inputs in my actual application (which I am doing using the basics of the tutorial).

I need to give classes to inputs to customize, and I need to add inputs to Collection users (using Accounts-password), how do I do that? The documentation teaches how to add using METEOR, but how to do using Meteor + angular?

I need the fields: Email, full name, cellular, date of birth, etc etc., the html of these fields I know how to do, with your inputs, but how to play these inputs in the user Ollection? (using package Accounts-password)

http://docs.meteor.com/api/passwords.html#Accounts-createUser

2 answers

2

When it comes to the Collection "users" Meteor offers a special schema that contains default fields as password, username, emails (an array of emails), createAt, service, and PROFILE (which is what you’re looking for). In the Voce profile object you can add data of your will such as name, age etc. In the Meteor documentation link you will find more details:

http://docs.meteor.com/api/accounts.html#Meteor-users

Just set a 'newUser' in your controller, for example.

<input type="text" ng-model="$ctrl.novoUser.profile.nome">
<input type="text" ng-model="$ctrl.novoUser.profile.idade">
<input type="text" ng-model="$ctrl.novoUser.password">


Accounts.createUser(novoUser); //no seu método salvar

I hope I’ve helped.

  • Thank you very much friend! Your reply was very concise and didactic, I hope it helps also other people!

0


It is worth remembering that if

Accounts.createUser(novoUser); //

If done in a client folder, the new user will be saved and the login will be done automatically, since if it is saved in a file on the server, the newUser will only be saved in Collection

  • Good initiative the add-on, can edit your reply, and add the add-on.

  • Thank you very much!!! Didn’t know this, really it does auto-login

Browser other questions tagged

You are not signed in. Login or sign up in order to post.