I am trying to build a web-page using angular. I need to connect only data's of 2nd ngFor loop that are correlated to 1st ngFor loop.
HTML CODE
<div *ngFor="let year of years">
<h2> {{year}} </h2> // For displaying the year row
</div>
<div *ngFor="let month of months">
<h4> {{month}}</h4> // For displaying the month row
</div>
//Now i need to print all the data respect to each month and data.
year = ['2019','2018','2017','2016']
month = ['jan','feb','mar','apr','may','jun','jul', 'aug','sep','oct','nov','dec']
Output should be like
2019 2018 2017 2016
jan feb mar apr may jun jul aug sep oct nov dec
(all data respect to each month and year should be present as shown)
2019
8th aug - data
5th aug - data
28th june - data
5 jan - data
2018
29th dec - data
21 dec - data
18 oct - data
(and so on...)
and if we click on any of the year, the page will scroll to that year. there may be all 12 months data for that year or may be only some months. so suppose if we click 2018 , then page will scroll to 2018 and then "if" i click on "oct" if there is a data for 2018 oct then it will scroll there else nothing will happen. it cant scroll to oct of any other year.
The structure of data is like
year -- date -- data
2019 -- 8th aug -- data
2019 -- 5th aug -- data