Advertisement
Guest User

Untitled

a guest
Aug 12th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. var appMainModule = angular.module('appMain', [ 'firebase','ngRoute'])
  2. .config(function ($routeProvider, $locationProvider) {
  3. $routeProvider.when('/', { templateUrl: '/Templates/CustomerLogin.html', controller: 'HomeCtrl' });
  4. $routeProvider.when('/customer/home', { templateUrl: '/Templates/CustomerHome.html' , controller:'ForLogout'});
  5. $routeProvider.when('/customer/singup', { templateUrl: '/Templates/CustomerSinup.html', controller: 'RegisterCtrl' });
  6. $routeProvider.when('/dashboard/godash', { templateUrl: '/Templates/dashboard.html', controller: 'DashboardCtrl' });
  7. $routeProvider.when('/customer/list', { templateUrl: '/Templates/CustomerList.html', controller: 'customerListViewModel' });
  8. $routeProvider.when('/customer/detail', { templateUrl: '/Templates/CustomerDetail.html', controller: 'customerDetailViewModel' });
  9. $routeProvider.when('/customer/googlemap', { templateUrl: '/Templates/GoogleMap.html', controller: 'MapCtrl' });
  10. // $routeProvider.when('/customer/postdata', { templateUrl: '/Templates/CustomerPostData.html', controller: 'AddPostCtrl' });
  11. $routeProvider.when('/customer/getdata', { templateUrl: '/Templates/CustomerGetData.html', controller: 'GetCtrl', reloadOnSearch: false });
  12. $routeProvider.when('/victim/getdata', { templateUrl: '/Templates/RiskVictimDetail.html', controller: 'VictimGetCtrl' });
  13.  
  14. $routeProvider.otherwise({ redirectTo: '/' });
  15. $locationProvider.html5Mode(true);
  16.  
  17. });
  18.  
  19. appMainModule.controller('HomeCtrl', ['$scope', '$location', 'CommonProp', '$firebaseAuth', function ($scope, $location,CommonProp, $firebaseAuth) {
  20. var firebaseObj = new Firebase("FireaseURL/");
  21. loginObj = $firebaseAuth(firebaseObj);
  22.  
  23. $scope.user = {};
  24. var login = {};
  25.  
  26.  
  27.  
  28. $scope.SignIn = function (e) {
  29. login.loading = true;
  30. e.preventDefault();
  31. var username = $scope.user.email;
  32. var password = $scope.user.password;
  33. loginObj.$authWithPassword({
  34. email: username,
  35. password: password
  36. })
  37. .then(function (user) {
  38. //Success callback
  39. // alert('Authentication successful');
  40. login.loading = false;
  41. $location.path('/dashboard/godash')
  42. }, function (error) {
  43. //Failure callback
  44. alert('Authentication failure');
  45. });
  46.  
  47. }
  48.  
  49.  
  50. }])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement