{"id":31236072,"url":"https://github.com/nitayneeman/ng-prevent","last_synced_at":"2026-05-17T03:08:35.669Z","repository":{"id":29339585,"uuid":"32873505","full_name":"nitayneeman/ng-prevent","owner":"nitayneeman","description":"An AngularJS directive which provides the ability to disable common behaviors of elements","archived":false,"fork":false,"pushed_at":"2017-08-22T15:42:09.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-04-10T05:51:43.764Z","etag":null,"topics":["angularjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nitayneeman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-25T15:30:54.000Z","updated_at":"2017-12-22T14:10:44.000Z","dependencies_parsed_at":"2022-09-06T19:30:41.611Z","dependency_job_id":null,"html_url":"https://github.com/nitayneeman/ng-prevent","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/nitayneeman/ng-prevent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitayneeman%2Fng-prevent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitayneeman%2Fng-prevent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitayneeman%2Fng-prevent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitayneeman%2Fng-prevent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nitayneeman","download_url":"https://codeload.github.com/nitayneeman/ng-prevent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nitayneeman%2Fng-prevent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276422172,"owners_count":25639633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-22T02:00:08.972Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angularjs"],"created_at":"2025-09-22T15:01:27.285Z","updated_at":"2025-09-22T15:02:35.678Z","avatar_url":"https://github.com/nitayneeman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ng-prevent [![Build Status](https://travis-ci.org/nitayneeman/ng-prevent.svg?branch=master)](https://travis-ci.org/nitayneeman/ng-prevent)\n##### An AngularJS directive which provides the ability to disable common behaviors of elements.\n\n## DEPRECATED\nThis repository is not maintained anymore.\n\n## Features\n* Disabling of user-select.\n* Disabling of context menu.\n* Disabling of specific key action.\n* Disabling of console actions.\n* Showing alerts on console.\n\n## Getting started\n#### Dependencies\nAngularJS v1.0.3, or a newer version.\n\n#### Usage\n1. Add one of dist files (original / min) to main file sources of project.\n2. Inject 'ngPrevent' as a dependency of your angular module.\n3. Start to prevent on any element you want!\n\n#### Options\nWhen you define prevent options on scope - you can use the following options:\n* userSelect \u003cbr /\u003e\n`true`: Preventing a user selection on the element. \u003cbr /\u003e\n`false`: Allowing a user selection on the element.\n* contextMenu \u003cbr /\u003e\n`true`: Preventing a context menu on the element. \u003cbr /\u003e\n`false`: Allowing a context menu on the element.\n* keys \u003cbr /\u003e\n`[]`: Preventing a key press on the element. \u003cbr /\u003e\nAcceptable values are: `BACKSPACE`, `TAB`, `ENTER`, `WIN_KEY`, `F11` and `F12`.\n* console \u003cbr /\u003e\n`[]`: Preventing an actions on console. \u003cbr /\u003e\nThe values of array are messages to console. \u003cbr /\u003e\nA message object pattern: `{ text: 'Message', style: 'CSS properties'}`\n\n## Samples\nAdd a prevent attribute on your element:\n```html\n\u003cdiv prevent=\"myPreventOptions\"\u003e\n  \u003cp\u003eText\u003c/p\u003e\n\u003c/div\u003e\n```\nmyPreventOptions should be on scope:\n```js\ndemoModule.controller('MainController', function ($scope) {\n    $scope.myPreventOptions = {\n        userSelect: true,\n        contextMenu: false\n    };\n});\n```\n\nAlternatively, definiton of preventOptions can be on rootScope:\n```js\ndemoModule.run(function ($rootScope) {\n    $rootScope.preventOptions = {\n        userSelect: true,\n        contextMenu: true,\n        console: [\n            {\n                text: 'Stop!',\n                style: 'color: red; font-size: 35pt'\n            },\n            {\n                text: 'Not allowed here!',\n                style: 'color: white; font-size: 30pt'\n            }\n        ],\n        keys: [\n            'F12',\n            'F11',\n            'WIN_KEY'\n        ]\n    };\n});\n```\n**Important note:** *Defintion of preventOptions on rootScope is overrides any other definition on children scopes. Use rootScope only if you want to prevent on the HTML tag. Any other mode, define on the appropriate scope.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitayneeman%2Fng-prevent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnitayneeman%2Fng-prevent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnitayneeman%2Fng-prevent/lists"}