You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Angular [wrapper component](./gridstack.component.ts) <gridstack> is a better way to use Gridstack, but alternative raw [NgFor](./ngFor.ts) or [Simple](./simple.ts) demos are also given.
3
+
The Angular [wrapper component](./gridstack.component.ts) <gridstack> is a better way to use Gridstack, but alternative raw [ngFor](./ngFor.ts) or [simple](./simple.ts) demos are also given.
4
4
5
-
##Dynamic grid items
6
-
this is the recommended way if you are going to have multiple grids (alow drag&drop between) or drag from toolbar to create items, or drag to remove items...
5
+
# Dynamic grid items
6
+
this is the recommended way if you are going to have multiple grids (alow drag&drop between) or drag from toolbar to create items, or drag to remove items, etc...
7
7
8
-
I.E. don't use Angular templating to create children as that is harder to sync.
8
+
I.E. don't use Angular templating to create grid items as that is harder to sync when gridstack will also add/remove items.
<gridstack-item*ngFor="let n of items; trackBy: identify"[options]="n">
72
-
Item {{n.id}}
73
-
</gridstack-item>
74
-
</gridstack>
75
-
```
76
133
77
134
## Demo
78
135
You can see a fuller example at [app.component.ts](https://github.com/gridstack/gridstack.js/blob/master/demo/angular/src/app/app.component.ts)
@@ -81,14 +138,15 @@ to build the demo, go to demo/angular and run `yarn` + `yarn start` and Navigate
81
138
82
139
## Caveats
83
140
84
-
- This wrapper needs v7.2+ to run as it needs the latest changes
141
+
- This wrapper needs v8.0+ to run as it needs the latest changes
85
142
- Code isn't compiled into a lib YET. You'll need to copy those files. Let me know (slack) if you are using it...
86
-
- BUG: content doesn't appear on new widget until widget is moved around (or another created that pushes it). Need to force angular detection changes...
87
143
88
-
## ngFor Caveats
144
+
## *ngFor Caveats
89
145
- This wrapper handles well ngFor loops, but if you're using a trackBy function (as I would recommend) and no element id change after an update,
90
-
you must manually update the `GridstackItemComponent.option` directly - see [modifyNgFor()](./app.component.ts#L83) example.
146
+
you must manually update the `GridstackItemComponent.option` directly - see [modifyNgFor()](./app.component.ts#L174) example.
91
147
- The original client list of items is not updated to match **content** changes made by gridstack (TBD later), but adding new item or removing (as shown in demo) will update those new items. Client could use change/added/removed events to sync that list if they wish to do so.
92
148
93
149
94
150
Would appreciate getting help doing the same for React and Vue (2 other popular frameworks)
// IFF we're not a subGrid, define what type of component to create as child, OR you can do it GridstackItemComponent template, but this is more generic
// IFF we're not a subGrid, define what type of component to create as child, OR you can do it GridstackItemComponent template, but this is more generic
0 commit comments