MCPcopy Index your code
hub / github.com/angular/angular / DynamicViewport

Class DynamicViewport

packages/core/test/linker/integration_spec.ts:2237–2267  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2235}
2236
2237@Directive({
2238 selector: 'dynamic-vp',
2239 standalone: false,
2240})
2241class DynamicViewport {
2242 private injector: Injector;
2243 constructor(private vc: ViewContainerRef) {
2244 const myService = new MyService();
2245 myService.greeting = 'dynamic greet';
2246
2247 this.injector = Injector.create({
2248 providers: [{provide: MyService, useValue: myService}],
2249 parent: vc.injector,
2250 });
2251 }
2252
2253 create(): ComponentRef<ChildCompUsingService> {
2254 return this.vc.createComponent(ChildCompUsingService, {
2255 index: this.vc.length,
2256 injector: this.injector,
2257 });
2258 }
2259
2260 insert(viewRef: ViewRef, index?: number): ViewRef {
2261 return this.vc.insert(viewRef, index);
2262 }
2263
2264 move(viewRef: ViewRef, currentIndex: number): ViewRef {
2265 return this.vc.move(viewRef, currentIndex);
2266 }
2267}
2268
2269@Directive({
2270 selector: '[my-dir]',

Callers

nothing calls this directly

Calls 1

DirectiveClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…