#How to track down why component method is called for every scroll position change?
8 messages · Page 1 of 1 (latest)
g!codeblock @tall maple Show your code
@tall maple, you can use the following snippet to have your code formatted and colored by Discord. Replace ts with the language you need (i.e. html, js, css, etc)
```ts
// your code goes here
```
<div *ngIf="show()">
<h3>{{ title }}</h3>
<div *ngFor="let item of items" [attr.data-ts-view]="item.views" class="container flex-v">
<div class="flex">
<ts-themed-svg *ngIf="item.data.type.visual" [id]="item.data.type.visual"
class="ts-icon-small ts-icon-margin-right">
</ts-themed-svg>
<ts-nullable-link [displayText]="item.data.type.name" [url]="item.data.type.uri"></ts-nullable-link>
</div>
<ts-formatted-content [content]="item.data.content"></ts-formatted-content>
</div>
</div>
import { Component, Input } from "@angular/core";
import { ViewData } from "../../dto/view-data";
import { TypeContentNode } from "../../dto/type-content-node";
@Component({
selector: "ts-type-content-table",
templateUrl: "./type-content-table.component.html",
styleUrls: ["./type-content-table.component.css"]
})
export class TypeContentTableComponent {
@Input() items: ViewData<TypeContentNode>[]=[];
@Input() title = "Items";
show(){
console.log("show called");
return this.items.length > 0;
}
}
Excellent! Thank you!