Guest User

Untitled

a guest
Jun 9th, 2016
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. 'use strict';
  2.  
  3. angular.module('myApp.pendaftaran', [])
  4.  
  5. .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
  6. $stateProvider
  7. .state('pendaftaran', {
  8. url: '/pendaftaran',
  9. data: {
  10. permissions: {
  11. except: ['isloggedin'],
  12. redirectTo: 'login'
  13. }
  14. },
  15. views: {
  16. 'Content': {
  17. templateUrl: "pendaftaran/pendaftaran.html",
  18. controller: 'PendaftaranCtrl as pendaftaran'
  19. }
  20. }
  21. })
  22. }])
  23.  
  24. .controller('PendaftaranCtrl', ['$http', '$auth', '$rootScope','$state', '$q' , function($http, $auth, $rootScope, $state, $q) {
  25. var vm = this;
  26.  
  27. vm.pendaftaran = [];
  28.  
  29. vm.error;
  30.  
  31. vm.no=function(){
  32. $state.go('login');
  33. }
  34.  
  35. vm.addUser = function() {
  36.  
  37. vm.username;
  38. vm.password;
  39. vm.confirm_password;
  40. vm.email;
  41. vm.nama;
  42. vm.telepon;
  43. vm.aktif = '1';
  44. vm.statbio = 'Belum Mengisi Biodata';
  45.  
  46. $http.post('http://localhost:8000/api/v1/pendaftaran', {
  47. username: vm.username,
  48. password: vm.password,
  49. email: vm.email,
  50. telepon: vm.telepon,
  51. aktif: vm.aktif,
  52. statbio: vm.statbio
  53. }).success(function(response) {
  54. vm.password = '';
  55. vm.confirm_password = '';
  56. vm.email = '';
  57. vm.telepon = '';
  58. }).error(function(){
  59. console.log("error");
  60. });
  61.  
  62. $http.post('http://localhost:8000/api/v1/calonmahasiswa', {
  63. nama: vm.nama,
  64. }).success(function(response) {
  65. vm.nama = '';
  66. $('#Popup').modal('show');
  67. }).error(function(){
  68. console.log("error");
  69. });
  70.  
  71.  
  72. };
  73.  
  74. vm.daftar = function(){
  75. //Perintah protokol HTTP untuk mengirimkan data store pada endpoint pendaftaran
  76. $http.post('http://localhost:8000/api/v1/pendaftarpen', {
  77. username: vm.username,
  78. password: vm.password,
  79. nama: vm.nama,
  80. email: vm.email,
  81. telepon: vm.telepon,
  82. keterangan: '1',
  83. tahapan:'1',
  84. status:'1',
  85. }).success(function(response) {
  86. vm.password = '';
  87. vm.confirm_password = '';
  88. vm.nama = '';
  89. vm.email = '';
  90. vm.telepon = '';
  91. //Perintah protokol HTTP untuk mengirimkan data store pada endpoint pendaftar
  92. $http.post('http://localhost:8000/api/v1/pendaftar', {
  93. username: vm.username,
  94. }).success(function(response) {
  95. vm.username = '';
  96. alert('sukses');
  97. $state.go('login');
  98. }).error(function(){
  99. });
  100. }).error(function(){
  101. alert('gagal');
  102. });
  103. }
  104.  
  105. }]);
Add Comment
Please, Sign In to add comment