我可能在这里遗漏了明显的内容,但是是否可以将数据绑定(bind)到 angular.dart Controller 中?作为一个注释,它可以采用属性映射,但由于(直接)创建 Controller 时不涉及 HTML,因此如何绑定(bind)这些属性?
更重要的是,假设我在一个页面上使用两个 Controller 。一个是可重复使用的 (A),另一个则不可重复使用 (B) - 因此要分开。如果 A 需要使用 B 的数据,我该如何实现这一目标?
最佳答案
由于您没有提供具体的示例或代码来说明您想要完成的任务,所以我不确定您真正想要什么。
您可以使用您提到的属性映射或此处提到的注释
- What is the annotation equivalent of map: const {'foo':'&foo'} in AngularDart?
- What is the equivalent annotation for the old map/@attr in AngularDart?
您可以绑定(bind)到与 Controller 关联的元素上的任何属性,并获取分配给 Controller 的值。 这与组件或指令相同。
关于dart - 将数据绑定(bind)到 angular.dart Controller 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21411538/