angular的坑
Published by Shangyu Liu,
1、*ngFor let temp of model中,temp是临时变量,是不可以进行双向数据绑定的!
2、httpclient的请求,get请求没有问题,可以看到请求中有querying string parameters中请求参数为键值对。但是post会有问题,必须要设置content-type为application/form,否则默认情况下数据不以表单形式发送,而是payload(不知到底是什么,回头再查)。
3、angular-cli可以提供angular的跨域功能,设置proxy.config.json,但是不能用ng serve来启动,要在package.json中配置start命令,指定proxy配置文件,并用npm start来启动
4、angular项目,使用angular-cli创建后,上传到github再clone下来ng-server无法启动,发现是项目根目录下存在一个隐藏文件:.angular-cli.json,进入文件夹,在终端使用命令:defaults write com.apple.finder AppleShowAllFiles Yes && killall Finder来显示隐藏文件,将其拷贝到github仓库中方能使用