如何限制资产文件直接在angular 4中访问 [英] how to restrict assets files to access directly in angular 4

查看:46
本文介绍了如何限制资产文件直接在angular 4中访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在angular 4的angular-cli json资产中有css和其他文件,希望限制这些文件的直接访问.示例:"assets":[source]该源具有example.js文件.www.example.com/example.js-用户不应直接访问此权限,而仅应由我的代码访问.

I have css and other files in assets of angular-cli json in angular 4. want to restrict those files from directly accessing. Example: "assets": [ source ] that source has example.js file. www.example.com/example.js - user should not access this directly only my code should access.

推荐答案

问题已解决.我刚刚导出了js代码,并导入了ts文件.此外,在编译器选项中添加allowJs也解决了我的问题.

Problem solved. I just exported js code and imported in ts files. Also adding allowJs in compiler option resolved my problem.

这篇关于如何限制资产文件直接在angular 4中访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆