I'm facing a frustrating dilemma because I am unsure of the best approach to take in this scenario. Below is the basic setup:
I aim to display the current status of a movie, which will have different messages in the DOM based on its state. A movie can fall into one of three states. Note: All movies are stored in a JSON file and displayed on a single page.
State 1
Movie released: true Movie in theaters: true
User text: "In theaters now!"
State 2
Movie release: true Movie in theaters: false
User text: "Buy now!" (The buy link will be included in the movie object)
State 3
Movie release: false Movie in theaters: false
User text: SHOW RELEASE DATE HERE
Therefore, the possibilities are: true,true || true,false || false,false.
HTML CODE
<div class="ui blue ribbon label" ng-if="vm.getRelease(movie)">
<i class="film icon"></i> {{vm.movieStatus}}
</div>
JavaScript Code
function getRelease(movie){
if(movie.released && movie.inTheaters){
vm.movieStatus = "In Theaters now!";
return true
} else {
return
}
}
JSON OBJECT
{
"_id": 1,
"name": "Captain America: Civil War",
"yay": 500365,
"nay": 14357,
"releaseYear": 2016,
"releaseDate": "27-4-2016",
"inTheaters": true,
"released": true,
"buyNow": "",
"imdbUrl": "http://www.imdb.com/title/tt3498820/",
"image_url": "http://cityplusme.com/images/CaptainAmericaCivilWar.jpg",
"description": "Political interference in the Avengers' activities causes a rift between former allies Captain America and Iron Man.",
"trailer": "https://www.youtube.com/watch?v=dKrVegVI0Us"
},
Although the current setup successfully displays "In Theaters now!", the challenge lies in implementing additional conditions and adjusting vm.movieStatus accordingly. Despite trying various methods, I am unable to find a solution.
Your assistance would be greatly appreciated!