AngularJS Iframe弹出窗口像fancybox?

时间:2013-12-11 06:29:02

标签: javascript php jquery angularjs angularjs-directive

我正在使用AngularJS和PHP编写Web应用程序。我想通过传递一些参数弹出一个弹出窗口并在弹出窗口中渲染一个新页面。 如何在AngularJS中打开像i-frame弹出窗口的花式框?

1 个答案:

答案 0 :(得分:2)

你使用AngularUI library做了很多事情。这是working fiddle

示例代码为:

<强> HTML

<div ng-controller="ModalDemoCtrl">    
    <button class="btn" ng-click="open()">Open me!</button>
    <div ng-show="selected">Selection from a modal: {{ selected }}</div>
</div>

<强>的JavaScript

var ModalDemoCtrl = function ($scope, $modal, $log) {

  $scope.items = ['item1', 'item2', 'item3'];

  $scope.open = function () {

    var modalInstance = $modal.open({
      templateUrl: 'some-dynamic.php',
      controller: ModalInstanceCtrl,
      resolve: {
        items: function () {
          return $scope.items;
        }
      }
    });

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

<强>一些-dynamic.php

<?php
echo "Some <b>html in</b> the modal";

当然,在完全运用示例之前,您应该更改上面的代码。