@myop/angular 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +474 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Official Angular bindings for embedding [Myop](https://myop.dev) components in your Angular applications.
|
|
4
4
|
|
|
5
|
-
Myop components are framework-agnostic UI components that can be updated in real-time without redeploying your application. Build once, embed anywhere, and iterate instantly.
|
|
5
|
+
Myop components are framework-agnostic UI components that can be updated in real-time without redeploying your application. Build once, embed anywhere, and iterate instantly. Perfect for teams that need to ship UI changes fast, A/B test components, or empower non-developers to customize the interface. Myop is also the safest way to adopt AI-generated components in your application—whether created by developers or non-developers—with built-in sandboxing and controlled integration.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@myop/angular)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://myop.dev/discord)
|
|
9
10
|
|
|
10
|
-
[Website](https://www.myop.dev/) | [Documentation](https://docs.myop.dev/) | [Dashboard](https://dashboard.myop.dev/)
|
|
11
|
+
[Website](https://www.myop.dev/) | [Documentation](https://docs.myop.dev/) | [Dashboard](https://dashboard.myop.dev/) | [Discord](https://myop.dev/discord)
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
13
14
|
|
|
@@ -15,8 +16,240 @@ Myop components are framework-agnostic UI components that can be updated in real
|
|
|
15
16
|
npm install @myop/angular
|
|
16
17
|
```
|
|
17
18
|
|
|
19
|
+
```bash
|
|
20
|
+
yarn add @myop/angular
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add @myop/angular
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Auto-Generated Angular Components
|
|
28
|
+
|
|
29
|
+
Myop automatically generates a typed Angular component package for every component you create in the [dashboard](https://dashboard.myop.dev/). Install it directly via npm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install https://cloud.myop.dev/npm/{component-id}/angular
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Setup (One-Time Configuration)
|
|
36
|
+
|
|
37
|
+
Add `node_modules/@myop` to your TypeScript compilation in `tsconfig.app.json`:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"extends": "./tsconfig.json",
|
|
42
|
+
"compilerOptions": {
|
|
43
|
+
"outDir": "./out-tsc/app"
|
|
44
|
+
},
|
|
45
|
+
"include": [
|
|
46
|
+
"src/**/*.d.ts",
|
|
47
|
+
"src/**/*.ts",
|
|
48
|
+
"node_modules/@myop/**/*.ts"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This allows Angular to compile the auto-generated component packages alongside your application code.
|
|
54
|
+
|
|
55
|
+
### Usage
|
|
56
|
+
|
|
57
|
+
Import and use the generated component directly. For example, if you created a table component called "users-table" in the dashboard:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { Component } from "@angular/core";
|
|
61
|
+
import { UsersTableComponent, UsersTableCtaPayloads, CtaEvent } from "@myop/users-table";
|
|
62
|
+
|
|
63
|
+
@Component({
|
|
64
|
+
selector: "app-root",
|
|
65
|
+
standalone: true,
|
|
66
|
+
imports: [UsersTableComponent],
|
|
67
|
+
template: `
|
|
68
|
+
<users-table
|
|
69
|
+
[data]="{ rows: users }"
|
|
70
|
+
(cta)="onCta($event)"
|
|
71
|
+
/>
|
|
72
|
+
`,
|
|
73
|
+
})
|
|
74
|
+
export class AppComponent {
|
|
75
|
+
users = [
|
|
76
|
+
{ id: 1, name: "Alice", email: "alice@example.com", role: "Admin" },
|
|
77
|
+
{ id: 2, name: "Bob", email: "bob@example.com", role: "User" },
|
|
78
|
+
{ id: 3, name: "Charlie", email: "charlie@example.com", role: "User" },
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
onCta(event: CtaEvent<UsersTableCtaPayloads>) {
|
|
82
|
+
switch (event.action) {
|
|
83
|
+
case "rowClicked":
|
|
84
|
+
console.log("Selected user:", event.payload.rowData);
|
|
85
|
+
break;
|
|
86
|
+
case "deleteClicked":
|
|
87
|
+
this.deleteUser(event.payload.userId);
|
|
88
|
+
break;
|
|
89
|
+
case "exportRequested":
|
|
90
|
+
this.exportToFormat(event.payload.format);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Why this is powerful:**
|
|
98
|
+
|
|
99
|
+
- **Fully typed** — The generated package includes complete TypeScript types for your component's data interface and all CTA event payloads
|
|
100
|
+
- **Auto loaded** — Components are fetched and rendered automatically, no manual setup required
|
|
101
|
+
- **Not in your code** — The actual component implementation lives on Myop and is loaded at runtime. Update your component in the dashboard and it's instantly live—no rebuild, no redeploy
|
|
102
|
+
- **Zero bundle impact** — The entire `@myop/angular` package costs only ~6KB gzipped—and that's the total cost whether you use 1, 2, or 1,000 components. Auto-generated component packages are just thin typed wrappers. The actual component implementations are loaded at runtime, meaning your Myop components can be as complex, feature-rich, and heavy as you need without adding a single byte to your application bundle. Consider typical bundle costs: a chart library (~60KB), a map component (~200KB), a data grid (~150KB), a rich text editor (~100KB), or a chat widget with emoji picker (~80KB). With Myop, all of these cost ~0KB to your bundle—they load on-demand when needed
|
|
103
|
+
|
|
104
|
+
**Environment options:**
|
|
105
|
+
|
|
106
|
+
Set the default environment for all components using `setEnvironment`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { setEnvironment } from "@myop/angular";
|
|
110
|
+
|
|
111
|
+
// Set default environment for all component loads
|
|
112
|
+
setEnvironment("staging");
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
You can also override the environment directly on a specific component:
|
|
116
|
+
|
|
117
|
+
```html
|
|
118
|
+
<myop-users-table
|
|
119
|
+
[data]="{ rows: users }"
|
|
120
|
+
[preview]="true"
|
|
121
|
+
environment="staging"
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Environments are fully configurable in the [dashboard](https://dashboard.myop.dev/), allowing you to test changes in staging before publishing to production.
|
|
126
|
+
|
|
127
|
+
For more details on auto-generated packages, see the [Auto-Generated Packages documentation](https://docs.myop.dev/docs/learnMyop/AutoGeneratedPackages).
|
|
128
|
+
|
|
129
|
+
## Requirements
|
|
130
|
+
|
|
131
|
+
- Angular 17.0+
|
|
132
|
+
|
|
18
133
|
## Quick Start
|
|
19
134
|
|
|
135
|
+
```typescript
|
|
136
|
+
import { Component } from "@angular/core";
|
|
137
|
+
import { MyopComponent } from "@myop/angular";
|
|
138
|
+
|
|
139
|
+
@Component({
|
|
140
|
+
selector: "app-root",
|
|
141
|
+
standalone: true,
|
|
142
|
+
imports: [MyopComponent],
|
|
143
|
+
template: `
|
|
144
|
+
<myop-component
|
|
145
|
+
[componentId]="'your-component-id'"
|
|
146
|
+
[style]="{ width: '600px', height: '400px' }"
|
|
147
|
+
(action)="onAction($event)"
|
|
148
|
+
/>
|
|
149
|
+
`,
|
|
150
|
+
})
|
|
151
|
+
export class AppComponent {
|
|
152
|
+
onAction(event: { action: string; payload: any }) {
|
|
153
|
+
console.log("Action:", event.action, "Payload:", event.payload);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Components
|
|
159
|
+
|
|
160
|
+
### `myop-component`
|
|
161
|
+
|
|
162
|
+
The main component for embedding Myop components.
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { Component } from "@angular/core";
|
|
166
|
+
import { MyopComponent } from "@myop/angular";
|
|
167
|
+
|
|
168
|
+
@Component({
|
|
169
|
+
selector: "app-dashboard",
|
|
170
|
+
standalone: true,
|
|
171
|
+
imports: [MyopComponent],
|
|
172
|
+
template: `
|
|
173
|
+
<myop-component
|
|
174
|
+
[componentId]="'abc123'"
|
|
175
|
+
[data]="{ items: items }"
|
|
176
|
+
(rowClicked)="onRowClicked($event)"
|
|
177
|
+
(load)="onLoad($event)"
|
|
178
|
+
(error)="onError($event)"
|
|
179
|
+
/>
|
|
180
|
+
`,
|
|
181
|
+
})
|
|
182
|
+
export class DashboardComponent {
|
|
183
|
+
items = [
|
|
184
|
+
{ id: 1, name: "Item 1" },
|
|
185
|
+
{ id: 2, name: "Item 2" },
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
onRowClicked(payload: any) {
|
|
189
|
+
console.log("Row clicked:", payload);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
onLoad(component: any) {
|
|
193
|
+
console.log("Loaded!", component);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
onError(error: string) {
|
|
197
|
+
console.error("Error:", error);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
#### Inputs
|
|
203
|
+
|
|
204
|
+
| Input | Type | Description |
|
|
205
|
+
|-------|------|-------------|
|
|
206
|
+
| `componentId` | `string` | The ID of the Myop component to load |
|
|
207
|
+
| `data` | `object` | Data to pass to the component via `myop_init_interface` |
|
|
208
|
+
| `style` | `object` | CSS styles for the container |
|
|
209
|
+
| `fadeDuration` | `number` | Loader fade-out duration in ms (default: `200`) |
|
|
210
|
+
| `environment` | `string` | Load from a specific environment (e.g., `"staging"`, `"prod"`) |
|
|
211
|
+
| `preview` | `boolean` | Load the unpublished preview version of the component |
|
|
212
|
+
|
|
213
|
+
#### Outputs
|
|
214
|
+
|
|
215
|
+
| Output | Type | Description |
|
|
216
|
+
|--------|------|-------------|
|
|
217
|
+
| `(action)` | `EventEmitter<{action, payload}>` | Generic handler for all CTA events |
|
|
218
|
+
| `([actionName])` | `EventEmitter<payload>` | Handler for specific actions (e.g., `(rowClicked)`) |
|
|
219
|
+
| `(load)` | `EventEmitter<component>` | Called when the component finishes loading |
|
|
220
|
+
| `(error)` | `EventEmitter<string>` | Called when loading fails |
|
|
221
|
+
|
|
222
|
+
#### Inputs for Loading/Fallback
|
|
223
|
+
|
|
224
|
+
| Input | Type | Description |
|
|
225
|
+
|-------|------|-------------|
|
|
226
|
+
| `loader` | `TemplateRef` | Loading indicator template (default: `null` - no loader). Use `MyopLoader` for default Myop loader |
|
|
227
|
+
| `fallback` | `TemplateRef` | Error fallback template (default: built-in `MyopFallback`). Override with custom template |
|
|
228
|
+
|
|
229
|
+
#### Environments & Preview
|
|
230
|
+
|
|
231
|
+
Myop supports multiple environments, allowing you to test changes before going live:
|
|
232
|
+
|
|
233
|
+
```html
|
|
234
|
+
<!-- Production (default) -->
|
|
235
|
+
<myop-component [componentId]="'abc123'" />
|
|
236
|
+
|
|
237
|
+
<!-- Load from staging environment -->
|
|
238
|
+
<myop-component [componentId]="'abc123'" environment="staging" />
|
|
239
|
+
|
|
240
|
+
<!-- Load unpublished preview version (for testing before publishing) -->
|
|
241
|
+
<myop-component [componentId]="'abc123'" [preview]="true" />
|
|
242
|
+
|
|
243
|
+
<!-- Combine both: preview version in staging -->
|
|
244
|
+
<myop-component [componentId]="'abc123'" environment="staging" [preview]="true" />
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Environments are configured in the [dashboard](https://dashboard.myop.dev/). Use `[preview]="true"` to test unpublished changes before making them live.
|
|
248
|
+
|
|
249
|
+
### `myop-container` (Legacy)
|
|
250
|
+
|
|
251
|
+
The legacy container component. Use `myop-component` for new projects.
|
|
252
|
+
|
|
20
253
|
```typescript
|
|
21
254
|
import { Component } from "@angular/core";
|
|
22
255
|
import { MyopContainerComponent } from "@myop/angular";
|
|
@@ -27,24 +260,256 @@ import { MyopContainerComponent } from "@myop/angular";
|
|
|
27
260
|
imports: [MyopContainerComponent],
|
|
28
261
|
template: `
|
|
29
262
|
<myop-container
|
|
30
|
-
[componentId]="'
|
|
31
|
-
[inputs]="{ data: myData }"
|
|
263
|
+
[componentId]="'abc123'"
|
|
32
264
|
(componentReady)="onReady($event)"
|
|
33
265
|
/>
|
|
34
266
|
`,
|
|
35
267
|
})
|
|
36
268
|
export class AppComponent {
|
|
37
|
-
myData = { items: [] };
|
|
38
|
-
|
|
39
269
|
onReady(component: any) {
|
|
40
|
-
console.log("
|
|
270
|
+
console.log("Ready!", component);
|
|
41
271
|
}
|
|
42
272
|
}
|
|
43
273
|
```
|
|
44
274
|
|
|
45
|
-
##
|
|
275
|
+
## Type-Safe Event Handlers
|
|
46
276
|
|
|
47
|
-
|
|
277
|
+
Define your CTA payloads for fully typed event handlers:
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
import { Component } from "@angular/core";
|
|
281
|
+
import { MyopComponent } from "@myop/angular";
|
|
282
|
+
|
|
283
|
+
// Define your component's data and CTA payload types
|
|
284
|
+
interface MyData {
|
|
285
|
+
items: { id: string; name: string }[];
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
interface RowClickedPayload {
|
|
289
|
+
rowIndex: number;
|
|
290
|
+
rowData: any;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
interface ItemSelectedPayload {
|
|
294
|
+
itemId: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
interface ExportRequestedPayload {
|
|
298
|
+
format: "csv" | "json";
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@Component({
|
|
302
|
+
selector: "app-dashboard",
|
|
303
|
+
standalone: true,
|
|
304
|
+
imports: [MyopComponent],
|
|
305
|
+
template: `
|
|
306
|
+
<myop-component
|
|
307
|
+
[componentId]="'dashboard-component'"
|
|
308
|
+
[data]="data"
|
|
309
|
+
(rowClicked)="onRowClicked($event)"
|
|
310
|
+
(itemSelected)="onItemSelected($event)"
|
|
311
|
+
(action)="onAction($event)"
|
|
312
|
+
/>
|
|
313
|
+
`,
|
|
314
|
+
})
|
|
315
|
+
export class DashboardComponent {
|
|
316
|
+
data: MyData = {
|
|
317
|
+
items: [
|
|
318
|
+
{ id: "1", name: "Item 1" },
|
|
319
|
+
{ id: "2", name: "Item 2" },
|
|
320
|
+
],
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
onRowClicked(payload: RowClickedPayload) {
|
|
324
|
+
console.log("Row clicked:", payload.rowIndex);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
onItemSelected(payload: ItemSelectedPayload) {
|
|
328
|
+
console.log("Item selected:", payload.itemId);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
onAction(event: { action: string; payload: any }) {
|
|
332
|
+
console.log(event.action, event.payload);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Configuration
|
|
338
|
+
|
|
339
|
+
### Preloading Components
|
|
340
|
+
|
|
341
|
+
Preload components for faster rendering:
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { preloadComponents, isPreloaded } from "@myop/angular";
|
|
345
|
+
|
|
346
|
+
// Preload multiple components
|
|
347
|
+
await preloadComponents(["component-1", "component-2"]);
|
|
348
|
+
|
|
349
|
+
// Check if a component is preloaded
|
|
350
|
+
if (isPreloaded("component-1")) {
|
|
351
|
+
console.log("Component is cached and ready");
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Custom Repository URL
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
import { setCloudRepositoryUrl } from "@myop/angular";
|
|
359
|
+
|
|
360
|
+
// Point to a custom Myop server
|
|
361
|
+
setCloudRepositoryUrl("https://your-custom-server.com");
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Environment Configuration
|
|
365
|
+
|
|
366
|
+
```typescript
|
|
367
|
+
import { setEnvironment } from "@myop/angular";
|
|
368
|
+
|
|
369
|
+
// Set default environment for all component loads
|
|
370
|
+
setEnvironment("staging");
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Local Development
|
|
374
|
+
|
|
375
|
+
```typescript
|
|
376
|
+
import { enableLocalDev } from "@myop/angular";
|
|
377
|
+
|
|
378
|
+
// Connect to local Myop development server (localhost:9292)
|
|
379
|
+
enableLocalDev();
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Advanced: Custom Repository
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
import { setCloudRepository, getCloudRepository } from "@myop/angular";
|
|
386
|
+
import { CloudRepository } from "@myop/sdk/helpers";
|
|
387
|
+
|
|
388
|
+
// Set a custom CloudRepository instance
|
|
389
|
+
const customRepo = new CloudRepository("https://custom-url.com");
|
|
390
|
+
setCloudRepository(customRepo);
|
|
391
|
+
|
|
392
|
+
// Get the current repository
|
|
393
|
+
const repo = getCloudRepository();
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Loading & Error States
|
|
397
|
+
|
|
398
|
+
By default, no loader is shown while the component loads. The Myop-branded fallback is displayed automatically on error.
|
|
399
|
+
|
|
400
|
+
### Using the Default Myop Loader
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
import { Component } from "@angular/core";
|
|
404
|
+
import { MyopComponent, MyopLoader } from "@myop/angular";
|
|
405
|
+
|
|
406
|
+
@Component({
|
|
407
|
+
selector: "app-example",
|
|
408
|
+
standalone: true,
|
|
409
|
+
imports: [MyopComponent, MyopLoader],
|
|
410
|
+
template: `
|
|
411
|
+
<myop-component [componentId]="'my-component'" [loader]="loaderTpl" [fadeDuration]="300">
|
|
412
|
+
</myop-component>
|
|
413
|
+
|
|
414
|
+
<ng-template #loaderTpl>
|
|
415
|
+
<myop-loader></myop-loader>
|
|
416
|
+
</ng-template>
|
|
417
|
+
`,
|
|
418
|
+
})
|
|
419
|
+
export class ExampleComponent {}
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Custom Loading State
|
|
423
|
+
|
|
424
|
+
```typescript
|
|
425
|
+
@Component({
|
|
426
|
+
selector: "app-example",
|
|
427
|
+
standalone: true,
|
|
428
|
+
imports: [MyopComponent],
|
|
429
|
+
template: `
|
|
430
|
+
<myop-component [componentId]="'my-component'" [loader]="loaderTpl" [fadeDuration]="300">
|
|
431
|
+
</myop-component>
|
|
432
|
+
|
|
433
|
+
<ng-template #loaderTpl>
|
|
434
|
+
<div class="custom-loader">
|
|
435
|
+
<app-spinner />
|
|
436
|
+
<p>Loading component...</p>
|
|
437
|
+
</div>
|
|
438
|
+
</ng-template>
|
|
439
|
+
`,
|
|
440
|
+
})
|
|
441
|
+
export class ExampleComponent {}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Custom Error Fallback
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
import { Component } from "@angular/core";
|
|
448
|
+
import { MyopComponent, MyopFallback } from "@myop/angular";
|
|
449
|
+
|
|
450
|
+
@Component({
|
|
451
|
+
selector: "app-example",
|
|
452
|
+
standalone: true,
|
|
453
|
+
imports: [MyopComponent, MyopFallback],
|
|
454
|
+
template: `
|
|
455
|
+
<myop-component [componentId]="'my-component'" [fallback]="fallbackTpl">
|
|
456
|
+
</myop-component>
|
|
457
|
+
|
|
458
|
+
<!-- Custom fallback -->
|
|
459
|
+
<ng-template #fallbackTpl>
|
|
460
|
+
<div class="error-state">
|
|
461
|
+
<p>Failed to load component</p>
|
|
462
|
+
<button (click)="retry()">Retry</button>
|
|
463
|
+
</div>
|
|
464
|
+
</ng-template>
|
|
465
|
+
|
|
466
|
+
<!-- Or use default Myop fallback explicitly -->
|
|
467
|
+
<ng-template #myopFallbackTpl>
|
|
468
|
+
<myop-fallback></myop-fallback>
|
|
469
|
+
</ng-template>
|
|
470
|
+
`,
|
|
471
|
+
})
|
|
472
|
+
export class ExampleComponent {
|
|
473
|
+
retry() {
|
|
474
|
+
window.location.reload();
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## Using in NgModules
|
|
480
|
+
|
|
481
|
+
If you're not using standalone components, import in your module:
|
|
482
|
+
|
|
483
|
+
```typescript
|
|
484
|
+
import { NgModule } from "@angular/core";
|
|
485
|
+
import { BrowserModule } from "@angular/platform-browser";
|
|
486
|
+
import { MyopComponent } from "@myop/angular";
|
|
487
|
+
import { AppComponent } from "./app.component";
|
|
488
|
+
|
|
489
|
+
@NgModule({
|
|
490
|
+
declarations: [AppComponent],
|
|
491
|
+
imports: [BrowserModule, MyopComponent],
|
|
492
|
+
bootstrap: [AppComponent],
|
|
493
|
+
})
|
|
494
|
+
export class AppModule {}
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
## API Reference
|
|
498
|
+
|
|
499
|
+
### Exports
|
|
500
|
+
|
|
501
|
+
| Export | Description |
|
|
502
|
+
|--------|-------------|
|
|
503
|
+
| `MyopComponent` | Main component for embedding Myop components |
|
|
504
|
+
| `MyopLoader` / `MyopLoaderComponent` | Default Myop-branded loading indicator (opt-in) |
|
|
505
|
+
| `MyopFallback` / `MyopFallbackComponent` | Default Myop-branded error fallback |
|
|
506
|
+
| `preloadComponents` | Preload components for faster rendering |
|
|
507
|
+
| `isPreloaded` | Check if a component is cached |
|
|
508
|
+
| `enableLocalDev` | Enable local development mode |
|
|
509
|
+
| `setCloudRepositoryUrl` | Set custom server URL |
|
|
510
|
+
| `setCloudRepository` | Set custom CloudRepository instance |
|
|
511
|
+
| `getCloudRepository` | Get current CloudRepository instance |
|
|
512
|
+
| `setEnvironment` | Set default environment |
|
|
48
513
|
|
|
49
514
|
## License
|
|
50
515
|
|