Hello guys,

I am trying to create a user from my controller, I am confused by the
AngularFire API especially by the $createUser. Are we supposed to create a
service for this feature, or just create a function in a controller and
target it from an ng-click .

Cheers,
Mehdi

--
You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
To post to this group, send email to firebase-angular@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/1c2bcbc4-d16c-4a9f-8662-f81fe0f135ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Jacob Wenger at Aug 16, 2014 at 4:18 am
    Hey Mehdi,

    You could make a service, but it's easiest to just call it straight from
    your controller. I would imagine you'd have an input form and when the
    submit button is pressed, you run a function which essentially does this:

    $scope.auth.$createUser($scope.newUser.email,
    $scope.newUser.password).then(function(user) {
       console.log("User created:", user);

       // log the user in
       $scope.auth.$login({
         email: $scope.newUser.email,
         password: $scope.newUser.password
       });
    }).catch(function(error) {
       console.log("Error:", error);
    });

    Read through our new AngularFire guide
    <https://www.firebase.com/docs/web/libraries/angular/guide.html> for a full
    introduction to the library.

    Jacob

    On Fri, Aug 15, 2014 at 8:57 PM, Mehdi M.Jamai wrote:

    Hello guys,

    I am trying to create a user from my controller, I am confused by the
    AngularFire API especially by the $createUser. Are we supposed to create a
    service for this feature, or just create a function in a controller and
    target it from an ng-click .

    Cheers,
    Mehdi

    --
    You received this message because you are subscribed to the Google Groups
    "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/firebase-angular/1c2bcbc4-d16c-4a9f-8662-f81fe0f135ab%40googlegroups.com
    <https://groups.google.com/d/msgid/firebase-angular/1c2bcbc4-d16c-4a9f-8662-f81fe0f135ab%40googlegroups.com?utm_medium=email&utm_source=footer>
    .
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "Firebase + AngularJS" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to firebase-angular+unsubscribe@googlegroups.com.
    To post to this group, send email to firebase-angular@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-angular/CAKZX5-5ML4JmzhNG1%2BM%3DjOCAvbEeaP3Kw45iFbXXNUXaxhO5DA%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupfirebase-angular @
postedAug 16, '14 at 4:02a
activeAug 16, '14 at 4:18a
posts2
users2

2 users in discussion

Jacob Wenger: 1 post Mehdi M.Jamai: 1 post

People

Translate

site design / logo © 2021 Grokbase