Answer the question
In order to leave comments, you need to log in
How to hide implementation in angular?
The template displays a list. Some elements of this list should not be shown (depending on the mode, which is stored in the component's modeDisplay variable). The code in the template is something like this:
<div class="inner item" *ngFor="let todo of todos" [ngClass]="{hidden: checkModeDisplay(todo.fields.isCompleted)}">
...........
</div>
private modeDisplay: string = 'all';
private checkModeDisplay(isCompleted): boolean {
let hidden = false;
if(this.modeDisplay == 'active' && isCompleted) {
hidden = true;
}
if(this.modeDisplay == 'completed' && !isCompleted) {
hidden = true;
}
return hidden;
};
Answer the question
In order to leave comments, you need to log in
The photos.get() method is called with the Community access key, as follows from the error message:
method is unavailable with group auth
vk_api.exceptions.ApiError: [27]
Group authorization failed:
method is unavailable with group auth.
You really have a very ugly solution. It's smarter to do this:
get displayedTodos() {
if (this.modeDisplay == 'active')
return this.todos.filter(todo => !todo.fields.isCompleted);
if (this.modeDisplay == 'completed')
return this.todos.filter(todo => todo.fields.isCompleted);
return this.todos;
}
<div class="inner item" *ngFor="let todo of displayedTodos">
...........
</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question