Skip to content

Commit

Permalink
update basic example
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoperra committed May 4, 2024
1 parent cfbd43f commit c01200b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/angular/basic/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
let header
"
>
{{ header }}
<div [innerHTML]="header"></div>
</ng-container>
</th>
}
Expand All @@ -33,7 +33,7 @@
let cell
"
>
{{ cell }}
<div [innerHTML]="cell"></div>
</ng-container>
</td>
}
Expand Down
12 changes: 4 additions & 8 deletions examples/angular/basic/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ChangeDetectionStrategy,
Component,
type OnInit,
Injectable,
signal,
} from '@angular/core'
import { RouterOutlet } from '@angular/router'
Expand Down Expand Up @@ -91,8 +91,8 @@ const defaultColumns: ColumnDef<Person>[] = [
styleUrl: './app.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent implements OnInit {
data = signal<Person[]>([])
export class AppComponent {
data = signal<Person[]>(defaultData)

table = createAngularTable(() => ({
data: this.data(),
Expand All @@ -101,11 +101,7 @@ export class AppComponent implements OnInit {
debugTable: true,
}))

ngOnInit() {
this.data.set(defaultData)
}

rerender() {
this.data.set(defaultData)
this.data.set([...defaultData.sort(() => -1)])
}
}

0 comments on commit c01200b

Please sign in to comment.