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

md-tab error when using async pipe #574

Closed
aminebizid opened this issue May 29, 2016 · 5 comments · Fixed by #639
Closed

md-tab error when using async pipe #574

aminebizid opened this issue May 29, 2016 · 5 comments · Fixed by #639
Assignees
Labels
P2 The issue is important to a large percentage of users, with a workaround
Milestone

Comments

@aminebizid
Copy link

Bug:

What is the expected behavior?

No console error

What is the current behavior?

zone.js:260 Uncaught TypeError: Cannot read property 'elementRef' of undefined

What are the steps to reproduce?

`
ngOnInit() {
this.weeks = this.inicidentReportService.getIncidentReports();
}

getIncidentReports() {
return this.http.get(
WebAPI.url() + '/api/incidentReport')
.map(request => request.json());
}

`

md-tab *ngFor="let w of weeks | async"

@jelbourn jelbourn added the P2 The issue is important to a large percentage of users, with a workaround label May 31, 2016
@jelbourn jelbourn added this to the alpha.6 milestone May 31, 2016
@snorkpete
Copy link

snorkpete commented Jun 4, 2016

This behaviour happens even if the array used in the ngFor directive isn't directly using the async pipe, but instead is being passed from another component that used the async pipe.

For, for eg, we have SmartComponent described as above:

ngOnInit() {
this.weeks = this.inicidentReportService.getIncidentReports();
}

getIncidentReports() {
return this.http.get(
WebAPI.url() + '/api/incidentReport')
.map(request => request.json());
}

and the template:
<dumb-component [tabs]="weeks | async">

And it uses DumbComponent that actually has the tabs component, but accepts the array for the tabs as an input property:

@component({
selector: 'dumb-component',
template: `
......
md-tab *ngFor="let t of tabs"

....
`
})
DumbComponent{
@input() tabs;
}

DumbComponent will error out with the same errror

@RicardoVaranda
Copy link

@robertmesserle @jelbourn This doesn't seem to have fixed the issue, I'm still getting the error using:


"@angular2-material/core": "^2.0.0-alpha.6",
    "@angular2-material/input": "^2.0.0-alpha.6",
    "@angular2-material/tabs": "^2.0.0-alpha.6",
    "@angular2-material/toolbar": "^2.0.0-alpha.6",

@robertmesserle
Copy link
Contributor

@RicardoVaranda Can you provide a plunker or some way for us to see your code failing? We include async tabs in our demo app, which is still working properly, so we'll need to see your app to determine what is different.

@RicardoVaranda
Copy link

It's been fixed, Update just required @angular/forms which was not met and caused the upgrade to fail and I missed it.

Thanks :)

@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants