search

Home  >  Q&A  >  body text

angular.js - How to implement angular single-page application

I have done a single-page project before, and I used ng-include to include all pages into the homepage.
In fact, I felt that this idea was not quite right at the time. I felt that ng-include should be used to include some public pages that are divided into pages, such as page headers and footers.
These are just two opposite ideas.
So my question is
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?
2. If ng-include is not used, what should be used to write a single-page application?

Original question: Correct usage of ng-include

为情所困为情所困2756 days ago613

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味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.

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-15 16:54:47

    http://stackoverflow.com/a/17544706/2586541

    http://www.bennadel.com/blog/2441-nested-views-routing-and-deep-linkin...

    reply
    0
  • Cancelreply