Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewContainer throws "has changed after it was checked" error #7443

Closed
cagataycivici opened this issue Mar 5, 2016 · 3 comments
Closed

ViewContainer throws "has changed after it was checked" error #7443

cagataycivici opened this issue Mar 5, 2016 · 3 comments
Labels
area: core Issues related to the framework runtime type: bug/fix

Comments

@cagataycivici
Copy link

I get an error from the second run of change detection in development mode but bindings do not change so I suspect it might be a bug.

Here is the plunk;

http://plnkr.co/edit/CXQq2lAriwZuzYZoMF3D?p=info

Tester simple creates an embedded view from a template element and sets a local variable.

import {Component,ElementRef,AfterViewInit,TemplateRef,ContentChild,ViewContainerRef,EmbeddedViewRef} from 'angular2/core';

@Component({
    selector: 'p-tester',
    template: ''
})
export class Tester  {

    @ContentChild(TemplateRef) tmpl: TemplateRef;

    constructor(private viewContainer: ViewContainerRef) {}

    ngAfterViewInit() {
        let view = this.viewContainer.createEmbeddedView(this.tmpl);
        view.setLocal('\$implicit', 'Optimus');
    }
}

Using it throws the error;

<div>
      <p-tester>
        <template #name>
          {{name}}
        </template>
      </p-tester>
 </div>

The text Optimus is displayed fine but console has the error.

@btford
Copy link
Contributor

btford commented Mar 9, 2016

According to @vsavkin, this is a legit bug.

@vicb
Copy link
Contributor

vicb commented Sep 26, 2016

obsolete

@vicb vicb closed this as completed Sep 26, 2016
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime type: bug/fix
Projects
None yet
Development

No branches or pull requests

4 participants