Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

FIFA World Cup 2014 with Angular.js & ASP.NET – Part II

0.00/5 (No votes)
24 Jun 2014 1  
FIFA World Cup 2014 with Angular.js & ASP.NET - Part II

In part 1, we learnt how to use Angular.js.
Now in this post, we are moving further as I shared we will do some more interesting things here.
In this demo, I have created the same type of JSON as we have created in the last post but it has some more values like:

MatchDate: ‘Localtime’,
MatchNumber: ‘Match64′,
GroupName: ‘Final’,
Stadium: ‘Maracanã-EstádioJornalistaMárioFilho’,
Venue: ‘RioDeJaneiro’,
TeamName1: ‘W61′,
TeamCode1: ‘W61′,
TeamName2: ‘W62′,
TeamCode2: ‘W62′

JSONformat
Thanks to Fifa.com  for providing the information.

I created the JSON from FIFA.com’s data (I hope they will not mind it.)
Now as mentioned earlier, it is exactly the same as we did in the last post, it has module, controller and groups properties.
In this, we added two more features which are Order By & filter.
Firstly, order by expression. So we have used order by expression in ng-repeat.

We have sorted this with matchDate with Order by expression as shown in the below image:

ng_Order_By
When you run it, then your result will be in order by MatchDate.

Match
Now what if you want to sort it by reverse date order, then it is also very simple. You just need to add “-“minus sign in front of MatchDate. Once you will do this, you will get the following output.

matchdate_with_ReveseOrder

Now we are interested in some specific information like particular group, particular match, and particular team so in such case we require Filter extension property.
In the current example, we have taken a textbox which has property ng-model. Now this ng-model value is passed in ng-repeat with filter option as shown in the below image.

filter_create
Now when you type value in textbox, you will get filtered result on the screen as:

Filter_Fifa_Result

I hope you enjoy it.

Soon, I will share code with another example.

Thanks & enjoy !!!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here