title: Angular pass onclick value
body: <p>I have on array of years links like this:</p>
  
  <pre><code>&lt;div class="header-years-container default-color"&gt;
                &lt;a class="years-items"  *ngFor="let year of yearsLink;" [ngClass]="{'active': selectedYear === year}" (click)="onSelectYear($event.target.innerText)"&gt;
                    {{ year }}
                  &lt;/a&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>and one property that show data for selectedYear. In ngOnInit method I set default value from array but I want to pass other value of year when user click on that. In Typescript looks this:</p>
  
  <pre><code>ngOnInit() {
      this.yearsLink = [...new Set(this.absenceWidgetService.getAbsencesData().map(item =&gt; item.year))];
      this.selectedYear = this.yearsLink[0];
  
  
      this.selectedYear = this.onSelectYear(this.selectedYear);
      this.absences = this.absenceWidgetService.getAbsencesData(this.selectedYear)
    }
  
  onSelectYear(value): string {
      return this.selectedYear = value;
    }
  </code></pre>
  
  <p>How can I pass each time correct value for selectedYear in getAbsenceData method when user do click event ? Currently I always have default value..</p>
  
  <p>Thanks.</p>