温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

angular.JS实现网页禁用调试、复制和剪切

发布时间:2020-08-25 22:33:37 来源:脚本之家 阅读:147 作者:多客博图 栏目:web开发

一、angular根据环境配置禁用调试:

// Disable debug data for production environment
// @link https://docs.angularjs.org/guide/production
$compileProvider.debugInfoEnabled( app.applicationEnvironment !== 'production');
$logProvider.debugEnabled( app.applicationEnvironment !== 'production');

上面就是根据当前的环境是不是生产环境,来禁用调试了。

二、然后angular单页web如果要禁用复制和剪切

其实实现也很简单,动态添加事件注册,在angular的模块bootstrap的时候注册就好:

// Then init the app
angular.bootstrap(document, [app.applicationModuleName]);

// Disable the copy and cut
document.oncopy = function () {
return false;
};

document.oncut = function () {
return false;
};

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作能带来一定的帮助,如果有疑问大家可以留言交流,谢谢大家对亿速云的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI