AngularDart:“逻辑页面"和意见是一对一或一对多或什么? [英] AngularDart: "logical pages" and views are 1-to-1 or 1-to-many or what?

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

问题描述

AngularDart(或 JS)中应用的逻辑页面"和视图之间的关系是什么?

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

例如,在 AngularDart 教程 Recipe Book 示例的上下文中,我最初将查看食谱"和编辑食谱"视为逻辑页面(或作为@pavelgj 建议的应用稳定状态).

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).

当我开始学习 AngularDart 教程时,我认为一个逻辑页面和 Angular 的视图"是一一对应的.但是在第 6 章中,视图被视为index.html 页面的一部分(用于生成查看配方"和编辑配方"):

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?

推荐答案

首先,网页"是什么意思?Angular.dart 用于构建单页应用程序,所以从技术上讲,整个 Angular 应用程序是单个网页.

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.

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

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:“逻辑页面"和意见是一对一或一对多或什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆