AngularDart: “logical pages” and views are 1-to-1 or 1-to-many or what?

雨燕双飞 提交于 2019-12-08 07:05:08

问题


What is the relationship between an app's "logical pages" and views in AngularDart (or JS)?

For example, in the context of the AngularDart tutorial Recipe Book example, I originally considered "view recipe" and "edit recipe" as logical pages (or as an app steady state as @pavelgj suggests).

When I started working through the AngularDart tutorial I thought that a logical pages and Angular "views" were in one-to-one correspondence. But in Chapter 6, views are treated as part of a the index.html page (which is used to generate "view recipe" and "edit recipe"):

  <!-- ... more page elements here ... -->
  <section id="details">
    <ng-view></ng-view>
  </section>

If a view can be part of a page, can a page contain multiple views?


回答1:


First, what do you mean by a "web page"? Angular.dart is used to build Single-page applications, so technically the whole angular app is a single web page.

We can expand the definition of a "page" to: stable state of the browser after the user performed an action. That would make term "page" meaningful for single-page applications.

Using the new definition of page: Because angular views can be nested and composed of other views they are not the same thing as a page. Page can be a collection of views. So page to view is 1-to-many. However, for most relatively simple applications that use flat routing that relationship is usually 1-to-1.



来源:https://stackoverflow.com/questions/21464198/angulardart-logical-pages-and-views-are-1-to-1-or-1-to-many-or-what

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!