【问题标题】:AngularJS Iframe pop window like fancybox?AngularJS Iframe 弹出窗口像fancybox?
【发布时间】:2013-12-29 00:13:21
【问题描述】:

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

【问题讨论】:

标签: javascript php jquery angularjs angularjs-directive


【解决方案1】:

您几乎可以使用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());
    });
  };
};

some-dynamic.php

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

当然,您应该在完整的工作示例之前更改上面的代码。

【讨论】:

  • 出租车你请检查你的小提琴plnkr.co/edit/?p=preview我想你错过了输入它。
  • 当然:)。无论如何,它是 AngularUI 的标准小提琴,所以你仍然需要按照我的建议进行代码更改。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多