Sprint #4 was a very productive sprint for my team. We were able to get a lot of research and planning done in regards to the tab component that we will be creating for the AMPATH project. We also narrowed down the exact functionality that this component will have and discussed how it will interact with the rest of the app. During this sprint, each member of my team began coding an Angular component to get a better understanding of how we can implement the tab functionality. I was able to create a test component with tab functionality that displays patient information.
My plan for writing the test component was to follow the beginning of the Angular Tour of Heroes tutorial then build off of it. This was a useful way to do it because I was able to start with a base application that I could modify into something else. My team decided that we should each create a component just to see how it worked, so it didn’t necessarily have to be related to the tab functionality. However, I decided to build a tab functionality for my component because I felt that it would give me a better understanding of what we would have to do to to get our project built. What my code does is display patient names on tabs at the top of the screen. When you click on one of the tabs, it brings up information about the patient including the name, id number, age, and gender. It also allows you to edit the patient’s name, which reflects instantly on the tab itself. For our actual project we will need to connect to some sort of database for patient information, but for this test I just created a Patient class with the attributes that each patient will have. I then have a mock-patients.ts file with an array of predetermined patient information. The patients.component.html file is where the tab functionality resides. I used the Angular Material Design tab component to build the tabs. This link was very helpful for showing how to implement that: https://material.angular.io/components/tabs/examples
The biggest challenge I had was making the correct set of patient information display when clicking on a tab. I originally had something similar to the Tour of Heroes tutorial, where clicking on something brings you to a separate section of html. However, this didn’t work great with the tab functionality, as it required waiting a few seconds before clicking on a tab would bring up the correct information. I was able to fix this by putting the part that displays patient information in the mat-tab-group and using *ngFor.
Overall I feel that this we made a lot of progress during this sprint. It felt good to finally code something with a tangible result. By creating the test project my memory of Angular and html was refreshed and I learned how to implement Angular Material Design. This will be a big help throughout the next few sprints as we develop the tab component for the AMPATH project.
From the blog CS@Worcester – Computer Science Blog by rydercsblog and used with permission of the author. All other rights reserved by the author.