Angular4 Components inheritance with abstract class

Update for Angular 10+ As of Angular 10, when using the IVY compiler, components that are inherited, and which contain Angular functionality, must be decorated with an empty @Directive() decorator. Read more about it here There’s no need to add @Component() annotations to abstract classes or register them to any module. It could be that … 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

When to use Standalone Components or Modules in Angular 14?

Standalone components are not mandatory and will never be, there is no rule when to use them. However, Angular Architects recommend to always use Standalone components at least for new components you create. They are simply more treeshakeable and less boiler. You can mix standalone components and modules also. For the mentioned recommendation of the … Read more

Blazor – cannot convert from ‘method group’ to ‘EventCallback’

You were close: <ChildComponent Item=”someModel” T=”SomeModel” DeleteCallback=”OnDeleteSomeModel” /> @code { SomeModel someModel = new SomeModel(); void OnDeleteSomeModel(SomeModel someModel) { … } } The EventCallback uses a generic type and blazor cannot infer it if you don’t pass the type to the component. This means that if you have a EventCallback<T> you need to pass the … Read more

Module vs. component design [closed]

I’d like to share my idea about this difference. Both component and module are used to refer to a group of functions or a part of a function. Module is more logical, for example: module Finance, module HR, module Manufacturing… in ERP system. On the other hand, component is more physical. In software, it can … Read more

Angular – Observable with async pipe used multiple times in template… Good Practice or Bad?

Using the async pipe makes handling subscriptions much easier. It automatically handles unsubscribing unlike subscribing in the component. That said, there is a better pattern than what the example is showing. Rather than having multiple async calls on components, you can write it 2 different ways. I’m assuming these components are in the same template … Read more

React – Dynamically Import Components

I think there may have been some confusion as to what I was trying to achieve. I managed to solve the issue I was having and have shown my code below which shows how I solved it. Separate File (ComponentIndex.js): let Components = {}; Components[‘Component1’] = require(‘./Component1’).default; Components[‘Component2’] = require(‘./Component2’).default; Components[‘Component3’] = require(‘./Component3’).default; export default … Read more

Show Dialog from ViewModel in Android MVVM Architecture

UI-related actions like opening new activities or showing dialogs are triggered from the view (an activity or fragment), not from a ViewModel. The ViewModel doesn’t have a reference to the view to prevent leaks and keep the presentation layer “reactive”. You can subscribe your view (activity or fragment) to an observable in the ViewModel so … Read more

Why is CommonJS only said to be suitable for non-browser apps?

CommonJS is definitely suitable for the browser, with some caveats. The CommonJS module pattern is quite nice (in my biased opinion), and is also a good stepping stone to the module system proposed for ECMAScript Harmony (the planned next release of the JavaScript language). Specifically, Harmony modules won’t have access to the global (“window”) object. … Read more

What is better in vue.js 2, use v-if or v-show?

tl;dr Assuming the question is strictly about performance: v-show: expensive initial load, cheap toggling, v-if: cheap initial load, expensive toggling. Evan You provided a more in depth answer at VueJS Forum v-show always compiles and renders everything – it simply adds the “display: none” style to the element. It has a higher initial load cost, … Read more