I've got a collection of emails stored in a JSON file, each with its own properties:
{"id":5,"lu":false,"statut":2,"nom_expediteur":"Brian Patterson","nom_destinataire":"Frank Martin","email_expediteur":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2d4dfd3c0c6dbdc86f2dbdcc6d7de9cd1dddf">[email protected]</a>","email_destinataire":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b2d262a393f22257f0b22292665282426">[email protected]</a>","date":"2013-08-08","objet":"sed vestibulum sit","contenu":"Duis bibendum, felis sed interdum venenatis, turpis enim blandit mi, in porttitor pede justo eu massa. Donec dapibus. Duis at velit eu est congue elementum."},
{"id":6,"lu":true,"statut":1,"nom_expediteur":"Patricia Berry","nom_destinataire":"Jean Bowman","email_expediteur":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="345e565b4359555a017452555751565b5b5f1a575b59">[email protected]</a>","email_destinataire":"<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="412b232e362c202f740124243134332d6f222e2c">[email protected]</a>","date":"2014-10-18","objet":"nibh in quis justo maecenas rhoncus","contenu":"Duis bibendum, felis sed interdum venenatis, turpis enim blandit mi, in porttitor pede justo eu massa. Donec dapibu...
Every email is assigned a status number ("statut" property), which categorizes them into:
- Inbox
- Sent messages
- Spam
- Trashed messages
My goal is to filter and display each message based on its status when clicking on a main section:
- Messages with "statut":"1" should be shown in the Inbox
- Messages with "statut":"2" should appear in Sent messages
- etc...
I'm utilizing AngularJS UI Router module for managing my views.
I'm unsure whether I need to create separate controllers for each main section applying specific filtering functions, use parameters in UI Router's state function, or develop custom filters for ng-repeat.
You can explore my Angular application on GitHub: http://github.com/jLinat/AngMail. Simply clone it, run "npm install", and launch the project with "grunt". To see it live, enter this URL in your browser: http://localhost:9001
Thank you.