- 博客(2)
- 收藏
- 关注
原创 angular如何跨域?
在前端项目中,少不了跨域,因为开发环境和后台不在同一服务器下。所以简单介绍一下angular的跨域 1、在src目录下新建proxy.conf.json文件,内容如下: { "/a":{//“/a”表示代表服务器的地址,可自定义 "target":"http://xxxxx.com",//此处设置获取数据的服务器的地址 "secure":false, "pathRewrite":{ "^/a":"" ...
2020-09-20 18:18:39 1201
原创 angular中关于change获取input type=“file”的文件内容
在使用angular时,想要使用<input type="file"/>来选择本地文件,并获取文件的内容,比如名字、大小等。这时候就需要在input中添加change事件来监听input的变化,具体如下: app.component.html: <inputtype="file"class="file"(change)=getFile($event)/> app.component.ts: publicname:any='';//保存文件名 p...
2020-08-24 20:57:30 1707
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人