Clear controls does not dispose them – what is the risk?

Asking for modifications like this is pointless, the Windows Forms team has been disbanded quite a while ago. It is in maintenance mode, only security issues and OS incompatibilities are considered. It is otherwise simple enough to create your own method to do this: public static class ExtensionMethods { public static void Clear(this Control.ControlCollection controls, … Read more

What does OSGi solve?

what benefits does OSGi’s component system provide you? Well, Here is quite a list: Reduced Complexity – Developing with OSGi technology means developing bundles: the OSGi components. Bundles are modules. They hide their internals from other bundles and communicate through well defined services. Hiding internals means more freedom to change later. This not only reduces … Read more

RxJS: takeUntil() Angular component’s ngOnDestroy()

You could leverage a ReplaySubject for that: EDIT: Different since RxJS 6.x: Note the use of the pipe() method. class myComponent { private destroyed$: ReplaySubject<boolean> = new ReplaySubject(1); constructor( private serviceA: ServiceA, private serviceB: ServiceB, private serviceC: ServiceC) {} ngOnInit() { this.serviceA .pipe(takeUntil(this.destroyed$)) .subscribe(…); this.serviceB .pipe(takeUntil(this.destroyed$)) .subscribe(…); this.serviceC .pipe(takeUntil(this.destroyed$)) .subscribe(…); } ngOnDestroy() { this.destroyed$.next(true); this.destroyed$.complete(); … Read more

Use component in itself recursively to create a tree

update forwardRef() isn’t required anymore because directives was moved to NgModule.declarations and therefore recursive components don’t need to be registered on themselves as directives anymore. Angular 4.x.x Plunker example original That supported. You just need to add the component to directives: [] in its @Component() decorator. Because the decorator comes before the class and classes … Read more

Angular – shared service between components doesn’t work

If you are providing your DataService inside the providers array of your @Component annotation, @Component({ … providers: [DataService], })… this service will be a singleton (it will create a new instance) for this component (and it’s children if they have not provided this service under their annotation also). If you want to use this service … Read more