Maybe I'm thinking in the completely wrong direction. But what I would like to do is call the value of a variable, which was defined in the template, in the component.
<button (click)="download()">...</button>
<ng-container *ngIf="objectlist | filterSort: sortColumnService.sortTerm() as filteredSkaterlist">
...
</ng-container>
Is there any clean way to access filteredSkaterlist
in a function of the component? To send the filteredSkaterlist
as argument of e.g. the click()
is no option because the button is out of scope.
@Component({...})
export class MyComponent {
...
download() {
// access value of filteredSkaterlist
}
}
Can you please try this way.
I've defined objectList() method with structural directive of *ngIf. We can define objectList() method in component class and return true or false depend on the condition.