之前有做过一个单页面项目,当时是用ng-include把所有页面给包含进首页。
其实当时就觉得这个思路不太对,我感觉ng-include应该是用来包含一些分页面的公共页面的,比如页头和页尾。
这刚好是两个反向的思路。
那么我的问题是
1、用ng-include来做单页面应用的思路是否正确?ng-include的正确用法是否是来包含公共部分代码的?
2、如果不用ng-include,那么使用什么来写单页面应用?
淡淡烟草味2017-05-15 16:54:47
This question can be extended to the use of angular templates.
Use of templates: http://www.zhihu.com/question/21635146/answer/18967226
Refer to Zhihu source code: view-source:http://zhuanlan.zhihu.com/Weekly/19620215
angular routing: http://my.oschina.net/tanweijie/blog/295111
Angular routing implementation: http://blog.csdn.net/violet_day/article/details/16974467
Keywords: ng-template, routeProvider
1. Is the idea of using ng-include for single-page applications correct? Is the correct usage of ng-include to include public parts of code?
It is not.
2. If ng-include is not used, what should be used to write a single-page application?
angular routing routeProvider
Angular front-end routing exists independently of the server, and nested views can use ui-router.
巴扎黑2017-05-15 16:54:47
http://stackoverflow.com/a/17544706/2586541
http://www.bennadel.com/blog/2441-nested-views-routing-and-deep-linkin...