File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -180,22 +180,18 @@ Each `<fa-icon>` declared inside an `<fa-stack>` element **must** include the `s
180
180
181
181
### Programmatic API
182
182
183
- To create ` FaIconComponent ` dynamically using ` ComponentFactoryResolver ` :
183
+ To create ` FaIconComponent ` dynamically:
184
184
185
185
``` ts
186
186
@Component ({
187
187
selector: ' fa-host' ,
188
- template: ' <ng-container #host></ng-container>'
188
+ template: ' <button (click)="createIcon()">Create</button><br>< ng-container #host></ng-container>'
189
189
})
190
190
class HostComponent {
191
191
@ViewChild (' host' , {static: true , read: ViewContainerRef }) container: ViewContainerRef ;
192
192
193
- constructor (private cfr : ComponentFactoryResolver ) {
194
- }
195
-
196
193
createIcon() {
197
- const factory = this .cfr .resolveComponentFactory (FaIconComponent );
198
- const componentRef = this .container .createComponent (factory );
194
+ const componentRef = this .container .createComponent (FaIconComponent );
199
195
componentRef .instance .icon = faUser ;
200
196
// Note that FaIconComponent.render() should be called to update the
201
197
// rendered SVG after setting/updating component inputs.
You can’t perform that action at this time.
0 commit comments