angular - 没有ManagedZone的提供者

标签 angular dart angular2-components

我在应用程序中添加了一个按钮

<material-button raised #dialog.show()>Show Dialog</material-button>

现在我明白了
Observatory listening at http://127.0.0.1:46411/
>EXCEPTION: Error in asset:angular2_components/lib/src/components/material_button/material_button.html:10:0
  EXCEPTION: Error in asset:angular2_components/lib/src/components/material_button/material_button.html:10:0
  ORIGINAL EXCEPTION: No provider for ManagedZone!
  ORIGINAL STACKTRACE:
  #0      _NullInjector.get (package:angular2/src/core/di/injector.dart:11:7)
#1      MapInjector.get (package:angular2/src/core/di/map_injector.dart:28:25)
#2      ReflectiveInjectorImpl._getByKeyDefault (package:angular2/src/core/di/reflective_injector.dart:804:18)
#3      ReflectiveInjectorImpl._getByKey (package:angular2/src/core/di/reflective_injector.dart:770:14)
#4      ReflectiveInjectorImpl.get (package:angular2/src/core/di/reflective_injector.dart:528:17)
#5      ElementInjector.get (package:angular2/src/core/linker/element_injector.dart:17:37)
#6      ElementInjector.get (package:angular2/src/core/linker/element_injector.dart:17:37)
#7      ViewMaterialButtonComponent0.createInternal (package:angular2_components/src/components/material_button/material_button.template.dart:99:166)
#8      AppView.createComp (package:angular2/src/core/linker/app_view.dart:159:12)
#9      DebugAppView.createComp (package:angular2/src/debug/debug_app_view.dart:63:30)

最佳答案

在我使用providers: [materialProviders]的组件中添加<material-button>可以解决此问题。

似乎需要该提供程序来产生涟漪效应。

感谢您对BrownRiceRice https://github.com/dart-lang/angular2_components/issues/14#issuecomment-257914810的提示

关于angular - 没有ManagedZone的提供者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40385314/

相关文章:

flutter - 浏览器选项卡在 Flutter Web 应用程序加载时显示项目名称

根中的Angular2动态组件注入(inject)

angular - 如何获取 angular2 组件的父 DOM 元素引用

javascript - Angular 2 : Service with Model - "no provider for model"

angular - 错误 TS7028 : unused label

json - 当json是数组列表时,如何将json转换为dart?

dart - 为什么 "Navigator operation requested with a context that does not include a Navigator"

html - ionic 2如何返回上一界面

asp.net - 使用 angular2 中的文件和 bool 值发送表单数据

angular - 如何使用 2 个参数创建主题(rx.js)?