Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thesharpieone/angular-off-click
Its like click, but when you don't click on your element.
https://github.com/thesharpieone/angular-off-click
angular javascript
Last synced: 17 days ago
JSON representation
Its like click, but when you don't click on your element.
- Host: GitHub
- URL: https://github.com/thesharpieone/angular-off-click
- Owner: TheSharpieOne
- License: mit
- Created: 2014-02-24T14:55:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-07-22T23:11:00.000Z (over 3 years ago)
- Last Synced: 2024-10-11T14:34:01.284Z (about 1 month ago)
- Topics: angular, javascript
- Language: JavaScript
- Size: 55.7 KB
- Stars: 70
- Watchers: 4
- Forks: 29
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[![GitHub version](https://badge.fury.io/gh/TheSharpieOne%2Fangular-off-click.svg)](https://badge.fury.io/gh/TheSharpieOne%2Fangular-off-click) [![npm version](https://badge.fury.io/js/angular-off-click.svg)](https://badge.fury.io/js/angular-off-click) [![Bower version](https://badge.fury.io/bo/angular-off-click.svg)](https://badge.fury.io/bo/angular-off-click) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/TheSharpieOne/angular-off-click/master/LICENSE.md)
angular-off-click
=================It's like click, but when you don't click on your element.
Installing
```
npm install angular-off-click --save
```
```html```
-OR-
```
bower install angular-off-click --save
```
```html```
-THEN-
```javascript
angular('yourAngularApp',['offClick']);
```Usage/Example
Here we have a slide out navigation div that will appear when the user clicks a button. We want the div to go away when they click off of it (`off-click`). We also want to make sure the button that triggers the div to open, also does initial close it ( `off-click-filter` ).
```html
Show Navigation
...
```The `off-click` attribute is the expression or function that will execute each time the user doesn't click on your element (or filter)
The optional `off-click-if` attribute is an expression that will determine if the `off-click` should trigger or not.
The included `off-click-filter` directive allows you to pass a comma separated list of targets whose `off-click` will not be triggered when the element `off-click-filter` was applied to is clicked (gets parsed as javascript, so remember to wrap in single quotes).
If you pass `off-click-filter="'*'"` that element will be a filter for every off-click on the page. The value is an angular expression and as such, you can also pass dynamic values like so: `off-click-filter="'#' + myIdInScope"` and `off-click-filter="myScopedVar"`.