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
Copy file name to clipboardExpand all lines: demo/angular/README.md
+20-15Lines changed: 20 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Angular wrapper
2
2
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.
3
+
The Angular [wrapper component](src/gridstack.component.ts) <gridstack> is a better way to use Gridstack, but alternative raw [ngFor](src/ngFor.ts) or [simple](src/simple.ts) demos are also given.
4
+
5
+
**NOTE:** still having [issue](https://github.com/gridstack/gridstack.js/issues/2310) exporting the files to be included by Angular projects, so for now copy gridstack/dist/ng/src/* to your project and adjust the paths below.
4
6
5
7
# Dynamic grid items
6
8
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...
// set globally our method to create the right widget type
87
-
GridStack.addRemoveCB=gsCreateNgComponents;
88
-
GridStack.saveCB=gsSaveAdditionalNgInfo;
89
94
}
90
95
91
96
// and now our content will look like instead of dummy html content
@@ -146,9 +151,9 @@ public identify(index: number, w: GridStackWidget) {
146
151
```
147
152
148
153
## Demo
149
-
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)
154
+
You can see a fuller example at [app.component.ts](src/app/app.component.ts)
150
155
151
-
to build the demo, go to demo/angular and run `yarn` + `yarn start` and Navigate to `http://localhost:4200/`
156
+
to build the demo, go to demo/angular and run `yarn` + `yarn start` and navigate to `http://localhost:4200/`
152
157
153
158
Code now shipped starting with v8.0+ in dist/ng for people to use directly!
154
159
## Caveats
@@ -159,7 +164,7 @@ Code now shipped starting with v8.0+ in dist/ng for people to use directly!
159
164
160
165
## *ngFor Caveats
161
166
- 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,
162
-
you must manually update the `GridstackItemComponent.option` directly - see [modifyNgFor()](./app.component.ts#L174) example.
167
+
you must manually update the `GridstackItemComponent.option` directly - see [modifyNgFor()](src/app.component.ts#L174) example.
163
168
- 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.
0 commit comments