【发布时间】:2017-11-14 12:40:00
【问题描述】:
我有一个简单的用例 - 我有一个丰富的对象模型,我在 AngularDart 应用程序中使用,我想要一个组件来显示模型的一个字段的当前状态,我想调用选择更改时模型上的方法(最终将更新绑定到 的字段)。
类似这样的:
应用组件.dart:
@Component(
selector: 'my-app',
styleUrls: const ['app_component.css'],
templateUrl: 'app_component.html',
directives: const [CORE_DIRECTIVES, materialDirectives],
providers: const [materialProviders],
)
class AppComponent {
Model myModel = new MyModel();
SelectionModel<String> selectModel = new SelectionModel();
}
应用组件.html:
<material-dropdown-select
[options]='myModel.listOfOptions'
[buttonText]='myModel.currentOption'
[selection]='selectModel'>
<!-- call myModel.changeOption(selectedOption) when selection changes -->
</material-dropdown-select>
【问题讨论】:
标签: dart material-design angular-dart angular-components