MobileAngularUi ng-repeat模态

时间:2016-03-17 21:10:27

标签: javascript angularjs mobile-angular-ui

我试过32400236/dynamically-generate-modals-with-mobileangularui但没有用。我也曾经写过:

<div class="access-item" ng-repeat="item in items track by $index">
 <a ui-turn-on="$index">Activate unique modal</a>
 <div ui-content-for="modals">
  <div class="modal modal-overlay" ui-if='$index' ui-state='$index'>
   ...

OR

<div class="access-item" ng-repeat="item in items track by $index">
 <a ui-turn-on="item.id">Activate unique modal</a>
 <div ui-content-for="modals">
  <div class="modal modal-overlay" ui-if='item.id' ui-state='item.id'>
   ...

但只有当模态启动时才会渲染最后一个模态。

正如我所说,我尝试通过ng-click执行的功能32400236/dynamically-generate-modals-with-mobileangularui说。但它没有被执行,也没有显示模态。

有正确的方法吗?

1 个答案:

答案 0 :(得分:0)

ng-repeat之外只有一个模型:

<div ui-content-for="modals">
        <div class="modal modal-overlay" ui-if='modal' ui-state='modal'>

和ng-click功能:

$scope.openModal = function (id) {
    var single_obj = $filter('filter')($scope.items, function (d) {return d.id === id;})[0];
    $scope.access = single_obj;
    SharedState.initialize($rootScope, 'modal'); 
    $rootScope.Ui.turnOn( 'modal' );
   }; 

像魅力一样!