mseemann / angular2-mdl

Angular 2 - 14 components, directives and styles based on material design lite (npm: @angular-mdl/core)
https://mseemann.io/angular2-mdl
MIT License
558 stars 93 forks source link

[Bug] MdlSelectComponent. Error after view destroy #1801

Open SridharSudharshan opened 5 years ago

SridharSudharshan commented 5 years ago

This seems to be the same as in this issue

Console log

Error: ViewDestroyedError: Attempt to use a destroyed view: detectChanges
    at viewDestroyedError (core.js:28817)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:45255)
    at checkAndUpdateView (core.js:44270)
    at callWithDebugContext (core.js:45631)
    at Object.debugCheckAndUpdateView [as checkAndUpdateView] (core.js:45193)
    at ViewRef_.detectChanges (core.js:31125)
    at MdlSelectComponent.renderValue (angular-mdl-select.js:680)
    at MdlSelectComponent.writeValue (angular-mdl-select.js:440)

Steps to reproduce

  1. Apply structural directive to MdlElement or its container
  2. Match conditions to destroy/init view
  3. Match conditions to init/destroy view

The issue verified both on reactive and template-driven forms

I've also tried applying this fix and it seems to work. Could you please take a look at this?

Thanks.

SridharSudharshan commented 5 years ago

I have opened a stackoverflow question for the same.