欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

property 'themeclass' does not exist on type 'overlaycontainer' 有大用

'OverlayContainer'类型中不存在属性'themeClass'。 #5

 关闭
GuateDevIO 打开了这个问题 on 25 Sep 2017 ·2评论

评论

@GuateDevIO
 
 

评论道 on 25 Sep 2017

我正在运行npm start时出现以下错误:C:/ Users /....../ angular-ngrx-material / src / app / app.component.ts(52,31)中的错误:属性'themeClass ''OverlayContainer'类型不存在。

根据最近的Angular Material更改日志,请访问https://github.com/angular/material2/blob/master/CHANGELOG.md#200-beta11-carapace-parapet-2017-09-21

overlay:既然Overlay是cdk的一部分而不是Angular Material的一部分,那么themeClass属性已被删除。要为叠加添加类以进行主题化,您可以这样做

overlayContainer.getContainerElement().classList.add('my-theme-class');

你能帮我解决这个问题。我想替换this.overlayContainer.themeClass = theme; 在app.component.ts中使用上面的代码将解决问题,但我担心它可能会破坏应用程序中的其他内容。提前致谢。

@tomastrajan
 
 
所有者

评论道 on 25 Sep 2017

没有检查代码(现在不能)我认为你很好地解决了这个问题。我不希望这会破坏其他任何东西,因为该代码只关注那一件事。

另一件事是,现在我们可能要import { OverlayContainer } from '@angular/cdk'代替'@angular/material'随意本地尝试和运行应用程序。如果你可以切换主题和下拉列表仍然有效,那么修复。您也可以尝试运行测试和prod构建(请参阅package.json for build.targets)也可以随意创建PR眨眼 谢谢你的麻烦工作!祝你有美好的一天!

@tomastrajan
 
 
所有者

评论道 on 25 Sep 2017

好的,已在1.13.0中修复,再次感谢。


来自  https://github.com/tomastrajan/angular-ngrx-material-starter/issues/5


Property 'themeClass' does not exist on type 'OverlayContainer'. #5

 Closed
GuateDevIO opened this issue on 25 Sep 2017 · 2 comments

Comments

@GuateDevIO
 
 

commented on 25 Sep 2017

I am currently getting the following error when running npm start: ERROR in C:/Users/....../angular-ngrx-material/src/app/app.component.ts (52,31): Property 'themeClass' does not exist on type 'OverlayContainer'.

As per the recent Angular Material changelog available here https://github.com/angular/material2/blob/master/CHANGELOG.md#200-beta11-carapace-parapet-2017-09-21

overlay: Now that the Overlay is part of the cdk rather than Angular Material directly, the themeClass property has been removed. To add a class to the overlay for theming, you can do

overlayContainer.getContainerElement().classList.add('my-theme-class');

Can you please help me with this issue. I think replacing this.overlayContainer.themeClass = theme; inside the app.component.ts with the above code will resolve the issue but I am afraid it may break other things in the App. Thanks in advance.

@tomastrajan
 
 
Owner

commented on 25 Sep 2017

Without checking the code (cant now) I think you troubleshooted the issue pretty well. I would not expect that to break anything else because that code was only concerned with that one thing.

Another thing is that now we probably have to import { OverlayContainer } from '@angular/cdk' instead of '@angular/material' feel free to try locally and run the app. If you can switch themes and dropdowns still work then thats the fix. U can try running tests and prod build too (see package.json for build.targets) Also feel free to create PR with the fix wink And thank you for your troubleahooting effort! Have a great day!

@tomastrajan
 
 
Owner

commented on 25 Sep 2017

Ok, was fixed in 1.13.0, thanks again.

@tomastrajan tomastrajan closed this on 25 Sep 2017


来自   https://github.com/tomastrajan/angular-ngrx-material-starter/issues/5


来自  https://github.com/angular/components/blob/master/CHANGELOG.md#200-beta11-carapace-parapet-2017-09-21

普通分类: