Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module("membership.controllers", [])
- .controller("UserController", function ($scope, $state, $ionicModal, $ionicModal, $ionicLoading, UserServices) {
- $scope.signIn = function(user) {
- console.log('Sign-In', user);
- $state.go('tab.dash');
- };
- $scope.formLoginData = {};
- $scope.formRegistrationData = {};
- $scope.userData = JSON.parse(window.localStorage.getItem("userData"));
- $ionicModal.fromTemplateUrl("templates/modalRegistration.html", {
- scope: $scope
- }).then(function (modal) {
- $scope.modal = modal;
- });
- $scope.signInWithEmail = function () {
- $scope.showLoadingBar("Signing In. . .");
- console.log("Username: " + $scope.formLoginData.username);
- console.log("Password: " + $scope.formLoginData.password);
- };
- $scope.signInUsingSocmed = function (authMethod) {
- UserServices.signInWithSocmed(authMethod);
- };
- $scope.registerUserWithEmail = function () {
- $scope.showLoadingBar("Signing Up. . .");
- console.log("Username: " + $scope.formRegistrationData.username);
- console.log("Password: " + $scope.formRegistrationData.password);
- $scope.modal.hide();
- };
- $scope.showLoadingBar = function (message) {
- $ionicLoading.show({
- template: "<ion-spinner icon='spiral'></ion-spinner> <br/>" + message,
- duration: '2000'
- });
- };
- // Cleanup the modal when we're done with it!
- $scope.$on('$destroy', function() {
- $scope.modal.remove();
- console.log("Modal Destroyed");
- });
- // Execute action on hide modal
- $scope.$on('modal.hidden', function() {
- // Execute action
- console.log("Modal Hidden");
- $scope.formRegistrationData = {};
- });
- // Execute action on remove modal
- $scope.$on('modal.removed', function() {
- // Execute action
- console.log("Modal Removed");
- });
- })
- .controller('DashCtrl', function($scope, FirebaseSocialAuth) {
- $scope.users = JSON.parse(window.localStorage.getItem("userData"));
- $scope.logout = function () {
- FirebaseSocialAuth.$signOut();
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement