2

I am writing a web application using the AngularJS and PHP. I want to open a pop-up by passing a few params and render a new page in the pop-up. How can I open a fancy-box like i-frame pop-up in AngularJS ?

Anish Nair
  • 3,238
  • 29
  • 41
Pradeep Jaiswar
  • 1,785
  • 7
  • 27
  • 48
  • Is the solution reside in the thread http://stackoverflow.com/questions/15812203/angularjs-show-popups-the-most-elegant-way – Vimal Patel Dec 11 '13 at 06:33

1 Answers1

2

You do pretty much anything using AngularUI library. Here's working fiddle for it.

Sample code would be:

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";

Of course you should change the code above before you have fully working example.

Omar Al-Ithawi
  • 4,988
  • 5
  • 36
  • 47