Giter Club home page Giter Club logo

baloons's Introduction

Baloons

This is simple angular module that contains directive and factory for creating modals. The modals are fully responsive to the content they hold and always centered both horizontally and vertically.

You simply need to define a controller with the help of the factory. This controller is then connected to a specific UI baloon markup element and is the handle that will help you controll the state of the baloon (inflated / deflated).

In this project you can find simple example of two modals that are controller by two separate controllers. Anyway, here is an example how to use the baloons module in your angular projects.

First you need to define the controller:

var module = ng.module('MyApp', ['baloons']);

module.controller('MyCtrl', ['$scope', 'baloonFactory', function($scope, baloonFactory){
	$scope.baloonInstance = baloonFactory.getNewBaloon({
		onInflate: function(){
			console.log('Baloon inflated');
		},
		onDeflate: function(){
			console.log('Baloon deflated');
		}
	});
}]);

Then you define the UI part with your content inside, here is an example:

<baloon baloon-controller="baloonInstance">
	<header>
		<h3>Simple Modal</h3>
	</header>
	
	<section>
			Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nam ipsa sapiente corporis dolorem ab ut molestias possimus commodi magni maiores iure ipsam amet at odio sunt voluptate temporibus rerum quos!
	</section>

	<footer>
		<button
			ng-click="baloonInstance.toggle();">Confirm</button>
		<button
			ng-click="baloonInstance.toggle();">Cancel</button>
	</footer>
</baloon>

The baloonFactory's getNewBaloon method gets a configuration object in which you define the events.

Events

  • onInflate -- called when the baloon (modal) is inflated (opened).
  • onDeflate -- called when the baloon (modal) is deflated (closed).
  • autoDeflate -- true/false if the baloon is deflated on clicking outside it (clicking the dimmed screen). By default this is set to true.
  • toggle -- Predefined event that toggles the baloon, directly accessible through the instance, meant to be used for controlling the state of the baloon.

Notes

In order to test the example you need to run it through http server rooted at the folder of the projects so that the directive template is correctly resolved.

This example was tested with the help of the python http server module.

baloons's People

Contributors

mitevs 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.