Skip to content

Destroyed view can be reattached to a view container #17780

Closed

Description

@maxkoretskyi

I'm submitting a ...


[ ] Regression (behavior that used to work and stopped working in a new release)
[ x] Bug report 
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

The destroyed view can be attached to the view container

Expected behavior

I thought that the view in the destroyed state cannot be used anymore

Minimal reproduction of the problem with instructions

Here is the plunker and the relevant code:

export class App {
  @ViewChild('vc', {read: ViewContainerRef}) vc;
  
  name:string;
  constructor(private resolver: ComponentFactoryResolver) {
    this.name = `Angular! v${VERSION.full}`;
  }
  
  ngOnInit() {
    const factory = this.resolver.resolveComponentFactory(AComponent);
    const ref = this.vc.createComponent(factory);
    
    setTimeout(()=>{
      ref.destroy();
    }, 2000);
    
    setTimeout(()=>{
      this.vc.insert(ref);
    }, 4000);
  }
}

Activity

  1. added a commit that references this issue on Aug 9, 2017
    e54bd59
  2. added a commit that references this issue on Aug 11, 2017
    4bff10a
  3. added 2 commits that reference this issue on Aug 26, 2017
    7ebc6e4
    99c981f
  4. angular-automatic-lock-bot commented on Sep 12, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions