Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Requirement Firebase JS SDK
- (function(){
- 'use strict';
- angular.module('ContohRegisterFirebase', [
- 'ionic',
- 'FirebaseService' // include dari file firebase-service.js
- ])
- .controller('RegisterPageCtrl', ['$scope', '$firebase', '$ionicPopup',
- function($scope, $firebase, $ionicPopup){
- $scope.models = {
- newUser: {
- email: 'tester@domain.com',
- password: 'P@ssw0rd'
- }
- };
- $scope.register = function(newUserInfo){
- $firebase.createUser(newUserInfo,
- function(userInfo){
- $ionicPopup.alert({
- title: 'Registration Success',
- template: 'Successfully created user account for ' + userInfo.email
- }).then(function(){
- newUserInfo.email = null;
- newUserInfo.password = null;
- });
- }, function(error){
- $ionicPopup.alert({
- title: 'Registration Failed',
- template: error.message
- });
- }
- );
- }
- // Panggil fungsi registrasi di controller ini, bisa di taro di dalam submit event
- $scope.register($scope.models.newUser);
- }
- ])
- ;
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement