![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
angular
Eknow05
自己选择的路,跪着也要爬完
展开
-
$http的post请求
在开发一个angular项目时,发现$http的post请求有2种不同的形式。分为包括文件的表单与纯文本框的表单。1.有文件上传的表单: $http.post(saveUrl, formdata, { headers: {'Content-Type':undefined}, transformRequest: angular.identity }原创 2017-09-03 10:51:50 · 2071 阅读 · 0 评论 -
angular的缓存机制
缓存数据,不仅能使数据得到存储,而且使项目能进行客观的性能优化。$http的缓存$http({ method: 'GET', url: 'api/user.json', cache: true})缓存能够服务的请求越多,整体系统性能就能提升越多。自定义请求$http({ method: 'GET', url: 'api/user.原创 2017-09-03 11:05:24 · 1114 阅读 · 0 评论 -
路由的优化
开发单页面应用时,url会出现#号字符。为了简洁设计,解决方案:$locationProvider.html5Mode(true)然而,会出现一种情况,便是点击路由后,刷新页面报404错误。原因 (查资料):1. 用户如果是先访问 首页(http://onbook.me),然后再跳转到 页面(http://onbook.me/book),则这个跳转是由Angula原创 2017-09-03 11:19:41 · 856 阅读 · 0 评论