0

Açısal olarak göreceli olarak yeni ve Bootstrap modelini projeme entegre ettim, ancak "program denetleyiciden" değeri kullanamıyorum.ui-bootstrap Açısal modal çözüm ve Kapsam değeri

Ben "ModalInstanceCtrl" Kontrolörün içinde"programcontroller" dan id_program istiyorum. RESOLVE'a eklemeye çalıştım ancak verileri alamadım.

Ben modal "ModalInstanceCtrl" Kontrolörün içinde başarıyla "programcontroller" dan RESOLVE'a kullanılarak kodlanmış veriler var.

Ama bu Snippet kullanarak id_prgram olsun tarihi: Yukarıdaki kod içerisindeydi

<input type="text" ng-hide=" true" ng-model="id_program" ng-init="id_program=item._id"> 

ng-repeat blok ve doldurulan alır. Sorunun neden olduğu asenkron olduğundan dolayı olduğunu biliyorum.

Başvuru için gerekli kodu ekledim.

catalogapp.controller('programcontroller', function ($scope, $uibModal, $log, $routeParams) { 

$scope.id_program = ""; 

$scope.title_program = ""; 

$scope.filter_program = $routeParams.seasonId; 

$scope.season_number = $routeParams.seasonNumber; 

$scope.model = { 
//got this from previous HTML page as routeparams 
    season_id : $routeParams.seasonId 
} 
$scope.animationsEnabled = true; 

$scope.program_array = [ 
    { 
     "_id" : "program:a8097ae943bdbd372906ea494ddecbf2", 
     "series" : "series:fcde9691e624ba50df9be71735f4bb14", 
     "title" : "title1", 
     "season" : "season:a6e4d728c316cdffa933490d4f538251", 

    }, 
    { 
     "_id" : "urn:esp:hbo:program:testprogram20160310", 
     "title" : "title1", 
     "series" : "series:4f19358c7377482f1310e5cfa06c5bd2", 
     "season" : "season:a6e4d728c316cdffa933490d4f538251", 
    } 
] 

$scope.items = [ 
    { 
     "title" : "title", 
     "_id" : "program:version:2541203f297f8f0d", 
     "shortTitle" : "shtitle", 
     "program" : "program:f555feb8dafc1bae42d", 
    }, 
    { 
     "title" : "title2", 
     "_id" : "program:version:40a2313f297f8f0d", 
     "shortTitle" : "shtitle2", 
     "program" : "program:f55asfsa57927411bd6545feb8dafc1bae42d", 
    }, 
    { 
     "title" : "title3", 
     "_id" : "program:version:403f297f8f0d", 
     "shortTitle" : "shtitle3", 
     "program" : "program:asdf5557927411bd6545feb8dafc1bae42d", 
    } 
] 

$scope.open = function (size) { 
    var modalInstance = $uibModal.open({ 
     animation: $scope.animationsEnabled, 
     templateUrl: 'myModalContent.html', 
     controller: 'ModalInstanceCtrl', 
     size: size, 
     backdrop: 'static', 
     resolve: { 
      items1: function() { 
       return $scope.items; 
      } 
     } 
    }); 

    modalInstance.result.then(function (selectedItem) { 
     $scope.selected = selectedItem; 
    }, function() { 
     $log.info('Modal dismissed at: ' + new Date()); 
    }); 
} 

}); 


catalogapp.controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, items1) { 
    $scope.items = items1; 

    $scope.cancel = function() { 
     $uibModalInstance.dismiss('cancel'); 


     }; 
}); 

HTML Kodu aşağıda verilmiştir !!!!

<!doctype html> 
<html> 
<head> 
    <title>HBO ESP Console</title> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular-animate.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.9/angular-route.js"></script> 
    <link href="//netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> 
    <link rel="stylesheet" type="text/css" href="/css/main.css"> 
    <script src="/controllers/programcontroller.js"></script> 


</head> 
<body style="background-color:#44484a"> 
    <h2>Program List</h2> 

    <script type="text/ng-template" id="myModalContent.html"> 
     <body ng-controller="ModalInstanceCtrl"> 
      <div class="modal-header"> 
       <h3 class="modal-title">Program Version</h3> 
      </div> 
      <div class="modal-body" style="float:left"> 
       <ul ng-repeat="item in items" style="list-style-type:none"> 
        <li class="image"> 
         <button type="button" style="background-color: #555555" class="btn btn-default"> 
          <img ng-src="http://icons.iconarchive.com/icons/atti12/tv-series-folder/512/Game-of-Thrones-icon.png" height="200" width="200" /> 
         </button> 
        </li> 
       </ul> 
      </div> 
      <div class="modal-footer"> 
       <button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button> 
      </div> 
     </body> 
    </script> 

    <div ng-controller="programcontroller"> 
     <input ng-hide=" true" type="text" ng-model="filter_program"><br><br> 
     <p ng-hide=" true">Season_id: {{model.season_id}}</p> 
     <p style="font-size:18px">Season Number:{{season_number}}</p> 
     <div style="float:left"> 
      <div style="float:left"> 
       <ul ng-repeat=" item in program_array | filter : filter_program" style=" list-style-type:none;float:left"> 
        <li class="image"> 
         <input type="text" ng-hide=" true" ng-model="id_program" ng-init="id_program=item._id"> 
         <input type="text" ng-hide=" true" ng-model="title_program" ng-init="title_program=item.title"> 
         <button type="button" style="background-color: #555555" class="btn btn-default" ng-click="open('lg')"> 
          <img ng-src="http://icons.iconarchive.com/icons/atti12/tv-series-folder/512/Game-of-Thrones-icon.png" height="200" width="200" /> 
         </button> 
         <p>{{item.title}}</p> 
         {{id_program}} 
        </li> 
       </ul> 
      </div> 
     </div> 
    </div> 
</body> 
</html> 

LÜTFEN bu adamlarla bana yardım edin !!!!!! Teşekkür

+0

Merhaba, kodunuzla codepen veya JSBin'e bir bağlantı ekleyebilir misiniz? – Rishab777

cevap

0

Açısal işlemeden önce bile filtre değerine erişmeye çalışıyorsunuz.

İşte çözüm

<ul ng-repeat="it in itm"> 
<li> 
    {{it._id}} 
    <input type="text" ng-hide="true" > 
    <button type="button" class="btn btn-default" ng-click="setFilter(it._id);open('lg')">Large modal --- {{it._id}}</button> 
</li> 
</ul> 

Kontrolör

$scope.setFilter = function (filterValue) { 
    $scope.filter = filterValue; 

} Burada

bu yardımcı olur Plunkr

Umut olmasıdır !!

+0

Hala çalışmıyor! tüm bağımlılıklar güncel ve ben bir şeyleri kontrol ettiğim gibi sanırım rahatsız edilmemeli ... !! – Monish

+0

Kodunuzla bir plunkr veya JSBin veya Codepen oluşturabilir misiniz? – Rishab777

+0

http://plnkr.co/edit/36qe1s0UtNc1GPs1ZNAB?p=preview – Monish

0

kaldır ng-kontrolör = "ModalInstanceCtrl"

<script type="text/ng-template" id="myModalContent.html"> 

ve ne olduğunu görün dan.

+0

Hala çalışmıyor! – Monish

+0

Bu plunker'a bir göz atın http://plnkr.co/edit/QUIFQMqkI256EYpHKRPS?p=preview ve herhangi bir açıklamaya ihtiyacınız varsa bana bildirin. Sorun, id_programın bir dizgedir ve ng-tekrarda çoklu girişe bağlı olmasıdır. – sdfacre