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

Suggestion: Check 'videos.results.length' before display in Template #1

Open
saulobr88 opened this issue Oct 10, 2017 · 0 comments
Open

Comments

@saulobr88
Copy link

Hi,

I'm using ionic-tmdb for my studies and I found this situation:
When clicking on a Movie that doesn't have Trailers (videos on Youtube), the property 'results[0].key' are undefined.

Example: https://api.themoviedb.org/3/movie/414906?api_key=3191a71fe91620589f637340f6a92180&append_to_response=videos

This movie has no trailers yet, so I create this in 'movie-details.ts':
`...

videoResults(movie){

if (movie.videos.results.length > 0){

return true;

}

return false;

}

...`

And put a ngIf in 'movie-details.html':
`...

<ion-row *ngIf="videoResults(movie)">

...`

This works well for me.

Thanks for sharing your project

@saulobr88 saulobr88 changed the title Sugestion: Check 'videos.results.length' before display in Template Suggestion: Check 'videos.results.length' before display in Template Oct 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant