• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    CoffeeScript
  • License
    Other
  • Created almost 11 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Very basic modal dialog directive for Angular.js

ngModal

ngModal is very simple Angular.js modal dialog directive.

ngModal Screenshot

Download

You can also install the package using Bower.

bower install ngModal

Or add it to your bower.json file:

dependencies: {
  "ngModal": "~1.2.0"
}

The Basics

To use the library, add the JS file and CSS file, and then include the module in your app:

app = angular.module("myApp", ["ngModal"])

The directive itself is called modal-dialog. The only required attribute is show, which should reference a boolean variable that controls whether or not the dialog is shown. Inside, you can put whatever HTML content you'd like.

<modal-dialog show='dialogShown' dialog-title='My Dialog'>
  <p>Dialog content goes in here</p>
</modal-dialog>

Inline Options

There are a few options that be configured inline with attributes.

Option Default Description
dialog-title null Title placed in the header of the modal dialog.
width 50% Width of the dialog. Can be specified in px or %.
height 50% Height of the dialog. Can be specified in px or %.
on-close null Call a function when the dialog is closed. Ex: on-close='foo()'

Example:

<modal-dialog show='dialogShown' dialog-title='My Dialog' height='400px' width='75%'>
  <p>Dialog content goes in here</p>
</modal-dialog>

Configuration Options

You can also pre-configure some options during your app's configuration phase.

app.config(function(ngModalDefaultsProvider) {
  ngModalDefaultsProvider.set('option', 'value');
  // Or with a hash
  ngModalDefaultsProvider.set({option: 'value', option2: 'value2'});
})
Option Default Description
closeButtonHtml 'X' By default, the close button is just an X character. But you can set it to any HTML. For example, if you're using font-awesome, you could set it to <i class='fa fa-times'></i>

Browser Support

So far, it has only been tested in Chrome. There is some CSS that is not compatible with with older browsers, including IE9.

Contributing

Contributions are welcome. Whenever possible, please include test coverage with your contribution.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

To get the project running, you'll need NPM and Bower. Run npm install and bower install to install all dependencies. Then run grunt in the project directory to watch and compile changes. And you can run karma start to watch for changes and auto-execute unit tests.

Potential Features Down the Road

  • Ability to integrate easily with UI-Router. This may be possible already, but it needs to be explored.

More Repositories

1

ngQuickDate

An Angular.js Date/Time picker directive that stresses speed of data entry and configuration
CoffeeScript
362
star
2

ngOnboarding

A tooltip-tutorial / onboarding framework for Angular.js
CoffeeScript
151
star
3

docx_replace

Find and replace variables inside a Microsoft Word document (.docx) template
Ruby
119
star
4

angular-starter-kit

An opinionated starter template for crafting single-page web applications using Angular.js, Coffeescript, SCSS, Jade, Bootstrap, UI-Router, Font-Awesome and a few other carefully picked tools.
CoffeeScript
38
star
5

hacker-news-for-chrome

A simple chrome extension for displaying the latest from Hacker News
JavaScript
35
star
6

angular-date-picker-polyfill

HTML5 Date Input Polyfill for AngularJS
CoffeeScript
19
star
7

angular-currency-mask

Angular directive for adding commas and proper formatting to a currency input text field.
JavaScript
17
star
8

MarkerClusterer

This is a fork of Xiaoxi Wu's MarkerClusterer library for Google Maps V3
JavaScript
8
star
9

angular-pdf-viewer

An angular.js directive that displays PDF documents using Mozilla's PDF.js library.
CoffeeScript
7
star
10

angular-lib-template

Starter template for creating an Angular.js library, such as a directive or service. Includes auto-compilation for Coffeescript and Less as well as testing support.
CoffeeScript
5
star
11

pandora_plus

A Google Chrome extension for improving the user experience of Pandora.com.
JavaScript
4
star
12

can_i_get_a_receipt_with_that

This is a contestant for the Google-sponsored Data Viz Challenge, in which we visualize how our individual federal income taxes are spent.
JavaScript
3
star
13

mobile_fixed_header_test

1
star
14

aa_rails_template

This is my very basic starter template for all new Rails projects
Ruby
1
star
15

ngTreeNav

Vertical tree-structed nav menu directive for Angular.js
JavaScript
1
star
16

capybara-page-object-helper

Helper module for creating page objects using Capybara and Rspec
Ruby
1
star
17

DotVim

My .vim folder, including my vimrc and gvimrc files
Vim Script
1
star
18

capybara-request-spec-helpers

A number of useful methods for nicer-looking integration/request specs using Rspec and Capybara
Ruby
1
star
19

vim_config_for_windows

My vim configuration on Windows
Vim Script
1
star