原文: https://www.cnblogs.com/sghy/p/9111293.htmlhtml
-----------------------------------------------------git
angular二、angular四、angular5 及以上版本的跨域问题。github
经过angular自身的代理转发功能npm
配置package.json json
两种方式启动代理服务
第一种:
启动项目经过npm start启动,会自动启动代理服务跨域
npm start
第二种:
或者直接如下命令启动代理服务angular2
ng serve --proxy-config proxy.conf.json
官网介绍:https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/proxy.mdangular4