├── .gitignore
├── Gruntfile.js
├── LICENSE.txt
├── README.md
├── bower.json
├── demo.html
├── dist
├── ng-modal.css
├── ng-modal.js
└── ng-modal.min.js
├── karma.conf.coffee
├── package.json
├── screenshot.png
├── spec
└── ng-modal-specs.coffee
├── src
├── ng-modal.coffee
└── ng-modal.less
└── vendor
└── browserTrigger.js
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | bower_components
3 | .DS_Store
4 | node_modules
5 | build
6 | spec/build
7 | ng-modal.zip
8 | dist/ng-modal.zip
9 |
--------------------------------------------------------------------------------
/Gruntfile.js:
--------------------------------------------------------------------------------
1 | module.exports = function(grunt) {
2 |
3 | // Project configuration.
4 | grunt.initConfig({
5 | pkg: grunt.file.readJSON('package.json'),
6 | coffee: {
7 | compile: {
8 | files: {
9 | "spec/build/specs.js": ["spec/*.coffee"],
10 | "dist/ng-modal.js": ["src/*.coffee"]
11 | }
12 | }
13 | },
14 | uglify: {
15 | my_target: {
16 | files: {
17 | "dist/ng-modal.min.js": "dist/ng-modal.js"
18 | }
19 | }
20 | },
21 | less: {
22 | compile: {
23 | files: {
24 | "dist/ng-modal.css": ["src/ng-modal.less"]
25 | }
26 | }
27 | },
28 | watch: {
29 | scripts: {
30 | files: ['**/*.coffee', '**/*.less'],
31 | tasks: ['coffee', 'uglify', 'less'],
32 | options: {
33 | debounceDelay: 250,
34 | },
35 | }
36 | },
37 | zip: {
38 | 'package': {
39 | cwd: 'dist/',
40 | src: ['dist/*.js', 'dist/*.css'],
41 | dest: 'dist/ng-modal.zip'
42 | }
43 | }
44 | });
45 |
46 | grunt.loadNpmTasks('grunt-contrib-coffee');
47 | grunt.loadNpmTasks('grunt-contrib-uglify');
48 | grunt.loadNpmTasks('grunt-contrib-less');
49 | grunt.loadNpmTasks('grunt-contrib-watch');
50 | grunt.loadNpmTasks('grunt-zip');
51 |
52 | grunt.registerTask('default', ['coffee', 'uglify', 'less', 'watch']);
53 | grunt.registerTask('package', ['coffee', 'uglify', 'less', 'zip']);
54 | };
55 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2013 Adam Albrecht and other contributors
2 | http://adamalbrecht.com
3 |
4 | Permission is hereby granted, free of charge, to any person
5 | obtaining a copy of this software and associated documentation
6 | files (the "Software"), to deal in the Software without
7 | restriction, including without limitation the rights to use,
8 | copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the
10 | Software is furnished to do so, subject to the following
11 | conditions:
12 |
13 | The above copyright notice and this permission notice shall be
14 | included in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 | OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ngModal
2 |
3 | ngModal is very simple [Angular.js](http://angularjs.org/) modal dialog directive.
4 |
5 |
6 | 
7 |
8 |
9 | ## Download
10 |
11 | * [Version 1.2.2](https://github.com/adamalbrecht/ngModal/archive/1.2.2.zip) - Compatible with Angular 1.2.x.
12 |
13 | You can also install the package using [Bower](http://bower.io).
14 |
15 | ```sh
16 | bower install ngModal
17 | ```
18 |
19 | Or add it to your bower.json file:
20 |
21 | ```javascript
22 | dependencies: {
23 | "ngModal": "~1.2.0"
24 | }
25 | ```
26 |
27 | ## The Basics
28 | To use the library, add the JS file and CSS file, and then include the module in your app:
29 |
30 | ```javascript
31 | app = angular.module("myApp", ["ngModal"])
32 | ```
33 |
34 | 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.
35 |
36 | ```html
37 |
38 |
Dialog content goes in here
39 |
40 | ```
41 |
42 | ## Inline Options
43 |
44 | There are a few options that be configured inline with attributes.
45 |
46 | | Option | Default | Description |
47 | | -------------- | ------- | ----------------------------------------------------------------- |
48 | | dialog-title | null | Title placed in the header of the modal dialog. |
49 | | width | 50% | Width of the dialog. Can be specified in px or %. |
50 | | height | 50% | Height of the dialog. Can be specified in px or %. |
51 | | on-close | null | Call a function when the dialog is closed. Ex: `on-close='foo()'` |
52 |
53 | **Example:**
54 |
55 | ```html
56 |
57 |
Dialog content goes in here
58 |
59 | ```
60 |
61 | ## Configuration Options
62 |
63 | You can also pre-configure some options during your app's configuration phase.
64 |
65 | ```javascript
66 | app.config(function(ngModalDefaultsProvider) {
67 | ngModalDefaultsProvider.set('option', 'value');
68 | // Or with a hash
69 | ngModalDefaultsProvider.set({option: 'value', option2: 'value2'});
70 | })
71 | ```
72 |
73 | | Option | Default | Description |
74 | | ------------------- | ------- | ---------------------------------------------------------------------------------------------------------------- |
75 | | 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 `` |
76 |
77 |
78 | ## Browser Support
79 |
80 | So far, it has only been tested in Chrome. There is some CSS that is not compatible with with older browsers, including IE9.
81 |
82 | ## Contributing
83 |
84 | Contributions are welcome. Whenever possible, please include test coverage with your contribution.
85 |
86 | 1. Fork it
87 | 2. Create your feature branch (`git checkout -b my-new-feature`)
88 | 3. Commit your changes (`git commit -am 'Add some feature'`)
89 | 4. Push to the branch (`git push origin my-new-feature`)
90 | 5. Create new Pull Request
91 |
92 | To get the project running, you'll need [NPM](https://npmjs.org/) and [Bower](http://bower.io/). 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.
93 |
94 | ## Potential Features Down the Road
95 |
96 | * Ability to integrate easily with [UI-Router](https://github.com/angular-ui/ui-router). This may be possible already, but it needs to be explored.
97 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ngModal",
3 | "version": "1.2.2",
4 | "main": ["dist/ng-modal.js", "dist/ng-modal.css"],
5 | "ignore": [
6 | ".gitignore",
7 | "bower_components",
8 | "node_modules",
9 | "spec",
10 | "src",
11 | "vendor",
12 | "demo.html",
13 | "Gruntfile.js",
14 | "karma.conf.coffee",
15 | "package.json",
16 | "screenshot.png"
17 | ],
18 | "dependencies": {},
19 | "devDependencies": {
20 | "angular": "~1.2.4",
21 | "angular-mocks": "~1.2.4",
22 | "jasmine": "~1.3.1",
23 | "karma-jasmine": "~0.1.3",
24 | "jquery": "~2.0"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |