【问题标题】:@Component viewBindings is deprecated, what to use instead?@Component viewBindings 已弃用,改用什么?
【发布时间】:2015-11-27 19:23:04
【问题描述】:

我正在试验 Angular 2 和 Dart。在this step of the tutorial 的末尾,DisplayComponent 类有一个Component 注释,并带有viewBindings 集:

@Component(selector: 'display', viewBindings: const [FriendsService])// this viewBinding
@View(...)
class DisplayComponent {
...
}

带有 angular2-dart 插件的 Atom 告诉我 viewBindings 已被弃用。这似乎符合the documentation

我尝试简单地从注释中删除变量,但我得到一个异常说No provider for FriendsService。我应该怎么做?

【问题讨论】:

  • @EricMartinez 这是一个简单的零钱下降吗?所以@Component(selector: 'display', viewProviders: const [FriendsService])?它有效,但我想确保我做对了。
  • 您可以在 2.0.0-alpha.41 (2015-10-13) 版本的 API DEPRECATION 部分看到更改:@Component(viewBindings: ...) -> @Component(viewProviders: ...) 所有版本的文件更改日志都在这里:https://github.com/angular/angular/blob/master/CHANGELOG.md
  • 有人介意回答这个问题吗?然后 Corey 可以接受它,并且问题显示为已回答而不是未回答。

标签: dart angular-dart angular


【解决方案1】:

为了完整性

在 Alpha 46 中,viewProviders (viewBindings => viewProviders) 和提供程序 (bindings => providers) 是最新的。

https://angular.io/docs/ts/latest/api/core/ComponentMetadata-class.html https://github.com/angular/angular/blob/master/CHANGELOG.md

【讨论】:

    猜你喜欢
    • 2016-02-17
    • 2011-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多