afspawnservice
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "afspawnservice", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "This is an Angular service that allows you to spawn components on-the-fly, with a service call. For more details, watch my talk here: https://www.youtube.com/watch?v=-Hy-i4q8Vtg&t=38s", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -35,3 +35,18 @@ # AFSpawnService | ||
####Spawning a component | ||
#### Add to `appModule.entryComponents` | ||
In order to be able to spawn a component like this, you have to tell Angular that this component is an | ||
`entryComponent`. This means that it isn't a child component of any other components. It is a top-level | ||
component. If you don't do this, you can't dynamically create the component with `AFSpawnService`. | ||
Here is how you do this: | ||
```typescript | ||
@NgModule({ | ||
... // ▼▼▼ By adding your component to the entryComponents, it is now ready to be spawned dynamically | ||
entryComponents: [ FooComponent ] | ||
... | ||
}) | ||
export class AppModule{} | ||
``` | ||
#### Spawning a component | ||
First import the component class that you want to spawn, and then call the spawn service, and pass in the class to it. | ||
@@ -38,0 +53,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34292
121