Categories
Angular Tutorials

Tailwind Arbitrary classes in Angular host properties

I wanted to add different classes to the host element based on certain condition. I could add the classes in the accompanying style file. However, they won’t be available to be used on the host element. Unless I change the encapsulation mode to ViewEncapsulation.None. That removes the encapsulation and make the style declarations global. Which […]

Categories
Angular Tutorials

Nice usage of rediretFunction in Angular Router

The rediretTo property in the Router now accepts a function since version 18. That can return a string or UrlTree. I have found one nice use case for it. Imagine you have following routes Here when we visit the /users we are redirected to /users/list. Now you are asked to create one more entry in […]

Categories
Angular Opinions

One less effect to reset signal in Angular

I need to fetch some posts. We will use the httpResource. HttpClient returned observables but this one is reactive wrapper around HttpClient. The response we get is a signal. We can render the content in template as {{ content.value() }} But there is new inquiry. We need filter by specific user, No problem we can […]

Categories
CSS Tutorials

Custom Checkbox Button with CSS :has()

The objective is to use checkbox to have effect of group buttons that can be toggled. For example, Button Groups from Bootstrap. Now they are much easier to implement with CSS :has functional pseudo class. We’ll start with some mark up, using regular form elements. Without any styles, our design look like below. Applying Styles […]

Categories
Java Script Opinions

Why redux pattern enforces Functional Programming

I am trying to go with the route of vanilla programming for my reactive needs. Hence I choose Proxy, A wrapper over a object, where we can listen to changes in properties. It has some traps, like get, set, has and so on. We are more interested in get so we can use it to […]