本文介绍了AngularDart:“逻辑页面”和视图是1对1或1对多或什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在AngularDart(或JS)中,应用程式的「逻辑网页」和「观看次数之间有什么关系?



例如,在食谱书示例,我最初认为查看食谱和编辑食谱为逻辑页面(或作为应用程序稳定状态为@pavelgj建议) >

当我开始通过我认为
a逻辑页面和Angular视图是一一对应的。但在第6章中,视图被视为 css的一部分 index.html 页面(用于生成查看配方食谱):

 <! -  ...更多页面元素 - > 
< section id =details>
< ng-view>< / ng-view>
< / section>

如果视图可以作为页面的一部分,多个视图?

解决方案

首先,网页是什么意思? Angular.dart用于构建,因此技术上整个角应用程序单个网页。



我们可以在用户执行操作后将页面的定义扩展为浏览器的稳定状态。这将使单词page对单页应用程序有意义。



使用页面的新定义:因为角度视图可以嵌套并由其他视图组成,与页面相同的东西。页面可以是视图的集合。所以页面查看是一对多。然而,对于使用平面路由的大多数相对简单的应用程序,关系通常是1对1。


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?

解决方案

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.

这篇关于AngularDart:“逻辑页面”和视图是1对1或1对多或什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 13:03