Advertisement
trezee

example.js

Dec 16th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('ui.bootstrap.demo', ['ui.bootstrap']);
  2. angular.module('ui.bootstrap.demo').controller('ModalDemoCtrl', function ($scope, $modal, $log,$http) {
  3.  
  4.     var poData= $http.get('add_po.php').success(function(data){
  5.  
  6.   $scope.items =data;});
  7.  
  8.   $scope.open = function (size) {
  9.  
  10.     var modalInstance = $modal.open({
  11.       templateUrl: 'myModalContent.html',
  12.       controller: 'ModalInstanceCtrl',
  13.       size: size,
  14.       resolve: {
  15.         items: function () {
  16.           return $scope.items;
  17.         }
  18.       }
  19.     });
  20.  
  21.     modalInstance.result.then(function (selectedItem) {
  22.       $scope.selected = selectedItem;
  23.     }, function () {
  24.       $log.info('Modal dismissed at: ' + new Date());
  25.     });
  26.   };
  27. });
  28. angular.module('ui.bootstrap.demo').controller('ModalSpgCtrl', function ($scope, $modal, $log,$http) {
  29.  
  30. var poData= $http.get('add_spg.php').success(function(data){
  31.  
  32.                 $scope.items =data;});
  33.  
  34.   $scope.open = function (size) {
  35.  
  36.                     var modalInstance = $modal.open({
  37.                       templateUrl: 'spgModalContent.html',
  38.                       controller: 'ModalInstanceCtrl',
  39.                       size: size,
  40.                       resolve: {
  41.                         items: function () {
  42.                           return $scope.items;
  43.                         }
  44.                       }
  45.                     });
  46.  
  47.                     modalInstance.result.then(function (selectedItem) {
  48.                       $scope.selected = selectedItem;
  49.                     }, function () {
  50.                       $log.info('Modal dismissed at: ' + new Date());
  51.                     });
  52.                   };
  53. });
  54. angular.module('ui.bootstrap.demo').controller('ModalInsCtrl',
  55.  
  56.  
  57.    function ($scope, $modal, $log,$http) {
  58.        
  59.     var poData= $http.get('add_material.php')
  60.                      .success(function(data){
  61.                       $scope.items = data;
  62.                 });
  63.  
  64.             $scope.open = function (size, $index) {
  65.  
  66.                     var modalInstance = $modal.open({
  67.                       templateUrl: 'insModalContent.html',
  68.                       controller: 'ModalInsertCtrl',
  69.                       size: size,
  70.                       resolve: {
  71.                         items: function () {
  72.                           return $scope.items;
  73.                         }
  74.                       }
  75.                     });
  76.  
  77.                     modalInstance.result.then(function (selectedItem) {
  78.                       $scope.selected = selectedItem;
  79.                     }, function () {
  80.                       $log.info('Modal dismissed at: ' + new Date());
  81.                     });
  82.                   };
  83.  
  84.       $scope.eyes = [];
  85.        
  86.     $scope.activeEye  = {
  87.         kd_barang: '',
  88.         nama_pemasok: '',
  89.         satuan: '',
  90.         qty:'',
  91.         valuta:''
  92.     }
  93.     $scope.delete = function(index){
  94.        $scope.eyes.splice(index,1);
  95.      }
  96.  
  97.     $scope.add = function ($index) {
  98.         $scope.eyes.push($scope.activeEye);
  99.         $scope.activeEye = {} /* reset active item*/
  100.  
  101.     }
  102.            
  103. });
  104. // Please note that $modalInstance represents a modal window (instance) dependency.
  105. // It is not the same as the $modal service used above.
  106.  
  107. angular.module('ui.bootstrap.demo').controller('ModalInsertCtrl', function ($scope, $modalInstance, items) {
  108.  
  109.   $scope.items = items;
  110.   $scope.selected = {
  111.     item: $scope.items[0]
  112.   };
  113.  
  114.   $scope.ok = function () {
  115.     $modalInstance.close($scope.selected.item);
  116.   };
  117.  
  118.   $scope.cancel = function () {
  119.     $modalInstance.dismiss('cancel');
  120.   };
  121. });
  122.  
  123. angular.module('ui.bootstrap.demo').controller('ModalInstanceCtrl', function ($scope, $modalInstance, items) {
  124.  
  125.   $scope.items = items;
  126.   $scope.selected = {
  127.     item: $scope.items[0]
  128.   };
  129.  
  130.   $scope.ok = function () {
  131.     $modalInstance.close($scope.selected.item);
  132.   };
  133.  
  134.   $scope.cancel = function () {
  135.     $modalInstance.dismiss('cancel');
  136.   };
  137. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement