So basically our HTML template will be like this:This may look tricky, but it is quite simple once we understand the main concepts. So we first need to see the list of trainers, then select them and check in other lists which pokemons and bages they have. For example, tabs can present different sections of news, different … Both should be declared as boolean in out .ts file, and we’ll init with the value for f_firstPanel in true.So, our app should look like this until this point:Let’s check the table of trainers, in the column for edit we define a button.
The trainer will be each object that we define in our array and we could access to any of its attributes.So maybe, the most important part will be in the definition of the array for the table, this will be done with [dataSource]=”dsTrainers”. There is a simplest way to do this by clonning the Object, this article give some ways to do that:We are going to see more of the Angular Material table in another story, thanks for reading this :) !import { MatTableModule } from '@angular/material';
{{trainer.name}} |
{{trainer.name}} | {{trainer.age}} | # Pokemons | {{trainer.pokemons.length}} | # Badges | {{trainer.badges.length}} |
---|