daily pastebin goal
22%
SHARE
TWEET

Untitled

a guest Dec 18th, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <ion-view view-title="Vehicle" >
  2.   <ion-content class="has-header has-footer">
  3.       <div>
  4.           <label class="item item-input">
  5.               <span class="error" ng-show="showMsgs && myform.myInputF.$error.required">*</span>
  6.               <div class="input-label">Vehicle Type</div>
  7.               <select ng-model="selectedValue">
  8.                     <option selected>Two Wheeler</option>
  9.                     <option>Four Wheeler</option>
  10.               </select>
  11.           </label>
  12.           <label class="item item-input">
  13.               <span class="error" ng-show="showMsgs && myform.myInputF.$error.required">*</span>
  14.               <span class="input-label">Vehicle Name</span>
  15.               <input type="text" placeholder="Enter Vehicle Name" name="myInputF" ng-model="vehicle.vehicleName" required>
  16.           </label>
  17.           <label class="item item-input">
  18.               <span class="error" ng-show="showMsgs && myform.myInputF.$error.required">*</span>
  19.               <span class="input-label">Description</span>
  20.               <input type="text" placeholder="Enter Vehicle Description" maxlength="500" name="myInputF" ng-model="vehicle.Description" required>
  21.           </label>
  22.           <button ion-button ng-click="addVehicletoDb()" align="col-center">submit vehicle</button>
  23.     </div>
  24.   </ion-content
  25.    
  26. malnut.controller('addVehicleController', ['$scope','$state', '$ionicHistory', '$ionicPopup', '$ionicLoading', '$http','loggedInUserService',function($scope, $state, $ionicHistory, $ionicPopup, $ionicLoading,$http,loggedInUserService) {
  27.       debugger;
  28.       $scope.response;
  29.       $scope.addVehicletoDb = function() {
  30.         alert(selectedName);
  31.  
  32.         debugger;
  33.         $ionicLoading.show({
  34.             template: '<ion-spinner></ion-spinner><br/>Loading...'
  35.         });
  36.         var userId=localStorage.getItem("userId");
  37.         $http.post("http://localhost/carvicewebservice/index.php?tag=registerVehicle&vehicleName="+vehicleName+
  38.                     "&description"+description+"&userId"+userId+"&vehicleTypeString"+vehicleTypeString+"").then(function (res){
  39.             debugger;
  40.             $ionicLoading.hide();
  41.             console.log(res);
  42.             $scope.response = res.data;
  43.             console.log($scope.response);
  44.             if($scope.response.error ==true){
  45.                     if($scope.response.error_msg =="Error creating vehicle Entry to database")
  46.                     {
  47.                         var errorMsg = "Error creating vehicle for User";
  48.                         $ionicPopup.alert({
  49.                             title: 'Alert',
  50.                             template: errorMsg
  51.                         });
  52.                   }
  53.             }else{
  54.                  var errorMsg = "Vehicle Registration done successfully!";
  55.  
  56.                     $ionicPopup.alert({
  57.                         title: 'Alert',
  58.                         template: errorMsg
  59.                     });
  60.                   //TODO: Need to go to profile and populate user vehicles
  61.                     $state.go("landing.profile");
  62.             }
  63.         });
  64.       };
  65.     }]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top