Giter Site home page Giter Site logo

angularpopup's Introduction

#Angular Popup

AngularJS popup/modal directive. Provides an overlay of content which will drop in and out of view accompanied by a fading backdrop.

##Installation

  • Install using bower by adding to bower.json or installing manually.
bower install sm-angular-popup

##Usage

  • Add sm.popup.css to your application and include sm.popup as a module dependency.
angular.module('app', ['sm.popup']);
  • Within your controller, include popup as a dependency. You can then use the following to show a popup.
popup.create({ controller: 'popupCtrl', templateUrl: 'popup.html' }).open();
  • To pass data to the popup controller, you can use the data key like so.
popup.create({ controller: 'popupCtrl', data: 'some data', templateUrl: 'popup.html' }).open();

##Methods

  • The only method initially available to the popup directive is create, as used above. However, once created you can then open and close the popup. You should do this inside of a controller that you have referenced inside of the popup function. You can reference the popup by including the dependency popupInstance.
angular.module('app').controller('popupCtrl', function ($scope, popupInstance) {
	$scope.closePopup = function () {
		popupInstance.close();
	};
});
  • To access data passed to the popup you should include popupData as a dependecy
angular.module('app').controller('popupCtrl', function ($scope, popupInstance, popupData) {
	$scope.closePopup = function () {
        console.log(popupData) //'some data';
		popupInstance.close();
	};
});
  • By default the scope of the popup is private, however you can allow access to global scopes by setting global: true within the popup function configuration object.
popup.create({ controller: 'popupCtrl', global: true, templateUrl: 'popup.html' }).open();

##To Do

  • Allow toggling of opening and closing popup animation.
  • Allow overriding of CSS classes.
  • Seperate popup backdrop and popup into two completely separate directives to allow backdrop to load even when the popup has not yet loaded.
  • Add test coverage.

angularpopup's People

Stargazers

Angus H. avatar

Watchers

James Cloos avatar Sean McCann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.