Alright, I recently switched form angularJS to angular 4.x and I am having some issues. Note that I am not moving any app, I am just building a new one from scratch, using Firebase as my back-end.
I got to the stage where I have authentication working fine (register and login). However, the built-in user system of Firebase allows for registration with email address and password - while I would like to add a username. The requirement is for this username to be unique.
As a structure, I have an auth.service which takes care of talking to firebase to register / login / logout. Conceptually speaking, my idea was as soon as a user wants to sign up (so, fills the form and click on the button), query the database for any user already registered with that name. Which is what I have been unsuccessfully trying to achieve. i query the data, but when I want to use it, it always comes as undefined...
To simplify, what would be the best way to ensure a user can register only if the username he chose is unique?
I would appreciate any help, even if it is just to point out a tutorial, I find the documentation to be very hard to follow. I am using firebase 3.9 with angularfire2 v4.
Thanks :)