Series

Frontend

118 articles in this collection about Frontend.

📚 118 Articles
How JavaScript Generators works with Examples
Frontend·

How JavaScript Generators works with Examples

Today I’ve been reading about Redux-Saga. One of the key concepts there is the use of generator functions (function*). Generators are a JavaScript feature I’d heard of before, but I never really needed them in my day-to-day work—probably because I di...

💀Don't Break UI with Jest Snapshot Testing 📷
Frontend·

💀Don't Break UI with Jest Snapshot Testing 📷

A few days ago, I was fixing a small accessibility issue and decided to remove some unnecessary wrappers around a few elements. After making those changes, all the tests passed successfully—including the E2E tests. Everything was green, so I opened a...

Angular 19 and ZoneLess
Frontend·

Angular 19 and ZoneLess

Don't care if you use Angular 14, 15...19; your apps are still under the Zone.js umbrella. Maybe you feel your Angular apps work well, but under the hood, with Zone.js, Angular needs to iterate over the entire DOM tree, impacting app performance. Thi...

Four JavaScript Challenges for Job Interviews
Frontend·

Four JavaScript Challenges for Job Interviews

During recent developer interviews, I noticed many candidates felt overwhelmed by coding challenges. For junior positions, it's common to be asked about basic JavaScript tasks. Today, I'll share essential data manipulation techniques that junior deve...

How to Handle Side Effects in Angular Using NgRx Effects
Frontend·

How to Handle Side Effects in Angular Using NgRx Effects

Side-effects! They are one of the most common tasks in our applications. In Angular, but build application if we don't take care the component ends with a lot of responsability, like get, process and render the data. But in Angular most of time when ...

How to Use NgRx Selectors in Angular
Frontend·

How to Use NgRx Selectors in Angular

In NgRx, when we want to get data from the store, the easiest way is by using store.select. It allows us to get any slice of the state. Yes, it sounds funny, but any slice returns an Observable<any>. For example: It is flexible but also risky becaus...

How to Implement ActionCreationGroup in NgRx
Frontend·

How to Implement ActionCreationGroup in NgRx

When you create actions in NgRx, you usually use the createAction function helper. We write our action names with an inline string about the source and the event, like [Cart] Update Price. This action is clearly linked with the Cart feature in our ap...

How to Debug NgRx Using REDUX DevTools in Angular
Frontend·

How to Debug NgRx Using REDUX DevTools in Angular

When we work with NgRx, tracing and debugging actions, knowing the current state of our store, and reproducing behavior are very important. We have a great tool to help us as developers debug and analyze our NgRx State: the Redux DevTools. The Redux ...

When and Why to Use REDUX NgRx in Angular
Frontend·

When and Why to Use REDUX NgRx in Angular

In a previous article, I wrote about managing the state in Angular by using Services, but when the application increases in size and needs to track and handle a large state, it becomes a bit complex and not easy to manage. For example, when we have m...

Testing in Angular: Replace Karma to Web Test Runner
Frontend·

Testing in Angular: Replace Karma to Web Test Runner

I was writing an article for Kendo about testing in Angular, but with the deprecation of Karma, I had some questions about the future of testing in Angular. I'm using Jest for my personal and professional projects, along with the Angular testing libr...

Using @Defer DeferViews in Angular 17
Frontend·

Using @Defer DeferViews in Angular 17

The Performance, this is one most important topics when we build applications, now days we work with huge amount of components and needs to think how to improve the bundle size in our apps. The Angular team knows that, and launches great and amazing ...

How to Detect and Fix Circular Dependencies in Typescript
Frontend·

How to Detect and Fix Circular Dependencies in Typescript

When coding in TypeScript or Angular and embracing types, sometimes we don't pay attention to "Circular dependencies". We create types and try to use them everywhere to match with the existing structure, and if we're not careful, it's so easy to crea...

Learn Route Parameters in Angular with Example
Frontend·

Learn Route Parameters in Angular with Example

When building applications in Angular, maintaining effective communication of data between components or routes is crucial. Sometimes we use a state manager, services, or take advantage of the URL to provide information as a convenient alternative. C...

Create ChatBot  with  Gemini, Kendo  UI, and Angular 17
Frontend·

Create ChatBot with Gemini, Kendo UI, and Angular 17

When I see many chats connected with AI, a friend once said it's difficult, but it isn't. Today, I want to demonstrate how easy it is to build your own chat connected with AI and a nice interface using just a few lines of code. we'll learn how to cr...

Web Accessibility: Working with Images and Content
Frontend·

Web Accessibility: Working with Images and Content

When we create a website, the content is more than just text. As I learned in my previous article, accessibility is about more than just aria-label or alt attributes in images. Sometimes we add more than images, like SVGs, charts, or even consider co...

Web Accessibility: Head Start
Frontend·

Web Accessibility: Head Start

Nowadays, when making an app, accessibility is often ignored, or some developers think that aria-label is all they need. Some people also think that adding accessibility takes more work or makes the design less appealing, but that's not true. Having ...

Simplify Routing Parameters in Angular Components
Frontend·

Simplify Routing Parameters in Angular Components

In my previous article on building a sample store, I explored the animation feature in Angular 17. At the same time, I also developed an extensive product page feature. The product detail page needs to extract the product ID from the URL using the ro...

My Top Angular Kendo Articles 2023
Frontend·

My Top Angular Kendo Articles 2023

As 2023 comes to an end, I find myself reflecting on the valuable lessons and knowledge I've gained through writing. In addition to this blog, I create content for Telerik Kendo. Today, I'm excited 😊 to share with you my top Kendo UI articles from t...

Why avoid using 'any' in TypeScript
Frontend·

Why avoid using 'any' in TypeScript

When we create applications in Angular, the any type is our "live-saver" when struggle with complex error messages, want to save time by not writing specific type definitions, or think that TypeScript's type checking limits our coding flexibility and...

How to Configure Jest in Angular 18
Frontend·

How to Configure Jest in Angular 18

When we write tests in Angular Jasmine and Karma are the default for testing library and runner, but the Angular team was working on bringing Jest to Angular. Today, we're going to experiment with the Jest Builder for Jest (Experimental) in Angular 1...

How to Learn Angular 17 Features with Angular.dev
Frontend·

How to Learn Angular 17 Features with Angular.dev

Angular 17 has been announced and is set to release in the upcoming days. It comes with a list of impressive new features, such as control flow, deferred views, hydration, server-side rendering (SSR), signals, and many more. One of the notable releas...

Svelte for the First Time: A Personal Experience
Frontend·

Svelte for the First Time: A Personal Experience

Sometimes we want to learn something, just for fun or to build new side projects. I heard about Svelte in 2016, but never tried it until a few months ago with Bezael to create a small microfrontend. However, yesterday I started to build a small side ...

Understanding InjectionContext and Signal Effects
Frontend·

Understanding InjectionContext and Signal Effects

Yesterday, I was chatting with my friend Jörgen de Groot about Signals. As our conversation shifted to cover effects, he encountered the error ERROR NG0203. Later, another friend approached me with the same issue. I decided to compose a brief article...

Head Start with Angular Signals: A Basic Overview
Frontend·

Head Start with Angular Signals: A Basic Overview

Since Angular 16, I have heard a lot about Signals, the @angular/team did great work listening to the community and improving the Signals API with Rxjs interop. Yesterday I was talking with my friend Juan Berzosa he hadn't played with Signals yet, So...

Combining Types and Interfaces with & or | in TypeScript
Frontend·

Combining Types and Interfaces with & or | in TypeScript

Today, I reviewed a piece of code where a variable could be of two types, but to enhance readability, the simple method is to use union and intersection. In this example, we have defined two interfaces, Player and Basket, each representing a specific...

How To Use Record Type In Typescript
Frontend·

How To Use Record Type In Typescript

Today I was facing a problem where I wanted an object with a list of properties but with specific values like: For example: export type NBATeam = "Lakers" | "Celtics" | "Bulls" | "Warriors"; const nbaChampionships = { Lakers: 17, Celtics: 17...

How To Debug Angular Applications Easy
Frontend·

How To Debug Angular Applications Easy

As developers, we use a lot of our coding time to fix bugs. Debugging helps us find and remove errors in software development. But sometimes, finding a bug takes longer than fixing it. That's when we need to learn some ways to debug our apps. Let's i...

Key RxJS Operators Every Angular Developer Should Know
Frontend·

Key RxJS Operators Every Angular Developer Should Know

Today, one of our teammates was curious about which RxJS operators they'd need to create a search feature in Angular. I let them know that while RxJS has loads of operators, they don't need to know them all. I usually stick with Map, Filter, Tap, Swi...

Using the Inject Function in Angular 15
Frontend·

Using the Inject Function in Angular 15

Since Angular 14/15, there has been an alternative way to inject dependencies into our Angular applications. I will show two cases of using the inject function with Angular 14/15. Inject Dependencies in Functions Using inject, we can create functions...

How To Test Components In Angular Using Testbed
Frontend·

How To Test Components In Angular Using Testbed

When talking about unit testing, the first definition that comes into our head is to test the minor testable parts of an app, like functions, methods, and classes. It sounds perfect for a simple function or isolated class without dependencies, but it...

How and When to Use Mocks or Spies on Unit Testing
Frontend·

How and When to Use Mocks or Spies on Unit Testing

A few days ago, my friend was writing tests for an Angular App with two dependencies and wanted to test his code. I suggested that he should Spy and Mock the dependencies. When deciding whether to use a Mock or a Spy, it is important to consider the ...

How to Build Your First App with Astro
Frontend·

How to Build Your First App with Astro

For a few years, web projects have been taking more and more responsibility, which means more and more JavaScript. Nowadays, the top SPA Frameworks, React, Vue, or Angular, have great developer experience and allow us to build complex applications bu...

Maximizing Your Angular Build Performance with ESBUILD
Frontend·

Maximizing Your Angular Build Performance with ESBUILD

ESBuild is a swift JavaScript compiler used for ViteJS. You can play with him in Angular, changing a single line in the angular.json file. Note: It is in experimental mode 😜 Change the builder from "@angular-devkit/build-angular:browser" to "@angula...

Using Strictly Typed Reactive Forms in Angular
Frontend·

Using Strictly Typed Reactive Forms in Angular

I continue to play with the new features of Angular 14/15, and one pending task is to learn about Typed Reactive Forms. The strict forms help us avoid many common issues when working with our forms. The best way to learn and understand why to use Typ...

How To Use Functional Router Guards in Angular
Frontend·

How To Use Functional Router Guards in Angular

Today I was talking with my friend Leifer, and he asked me some about Functional Guards in Angular (14/15) with some questions. How do functional Router Guards work? Can The Class guards continue working in Standalone Components? How hard is conve...

Triggering Validation in Angular's Reactive Forms
Frontend·

Triggering Validation in Angular's Reactive Forms

Today with my friend @alt148 I was playing with Dynamic Forms, and we discovered changing one form control can trigger the validation several times in the validation process. For example, we have a form with a field, and in every key press, the form ...

Creating Dynamic Forms in Angular: A Step-by-Step Guide
Frontend·

Creating Dynamic Forms in Angular: A Step-by-Step Guide

In Angular Apps, making and updating forms is done by hand. Even small changes like adding a new field or changing its type can be difficult. Why not make forms adaptable to business changes? Why not transition to dynamic forms instead of hard-coded ...

Head Start With Standalone Components in Angular 15
Frontend·

Head Start With Standalone Components in Angular 15

Since version 15, Angular introduced Standalone Components as an easy way to build module-less applications. One of the benefits of Standalone Components is that they make Angular easier for new developers to learn and use, as they do not require an ...

How to Build Composable & Compound Components in Angular
Frontend·

How to Build Composable & Compound Components in Angular

When we need to have different versions and use cases and make it flexible to the changes, however, some stuff becomes a bit complex. For example, we need to show the list of the country in one case, the company flag or the name of the selected count...

Optimizing Your Workflow with Multiple Projects in Angular
Frontend·

Optimizing Your Workflow with Multiple Projects in Angular

When we build our Angular apps, splitting the code into modules is good to keep the code in a specific place, but sometimes we need to break it into the project to put everything in an isolated area. By default, Angular CLI generates an initial appli...

How To Check Types In Typescript
Frontend·

How To Check Types In Typescript

In Typescript, we have to check for values types like boolean, string, object instance from class, and the values in objects. 👉🏽 Why pay for hosting? Click here to deploy your Angular apps for free on a reliable VPS In Typescript, we have three w...

3 Ways of Type Transformation in Typescript
Frontend·

3 Ways of Type Transformation in Typescript

When we use types or interfaces, the typescript compiler enforces the object fit with them to avoid runtime errors for missing fields. Sometimes we want the flexibility to create an object without breaking the contract with the interface type. For ex...

How to handle and catch errors in Rxjs
Frontend·

How to handle and catch errors in Rxjs

In Rxjs, when we work with observables handling the errors is a bit confusing for beginners because you can think of a try-catch, but Rxjs comes with operators to manage it, so what can I use and when? Let's move to each step with code, the example u...

Understand Composition and inheritance in Angular.
Frontend·

Understand Composition and inheritance in Angular.

When we start to build the application and feel the code duplicated are in several places, our first idea is inheritance, because it solves our problem with repetitive code. It appears as a solution (and it's) and works. But the problem comes when we...

How to Share Data Between Components in Angular
Frontend·

How to Share Data Between Components in Angular

When we build components in an application, we maybe need to share or send data from parent to child without a direct connection. 👉🏽 Why pay for hosting? Click here to deploy your Angular apps for free on a reliable VPS Angular provides different...

How To Test Private Methods in Typescript
Frontend·

How To Test Private Methods in Typescript

Sometimes we need to test a private method, and Yes, maybe it's not a best practice, but in my case, I have a situation when I need to add a test to my private method, and if you have the same situation I hope it helps you. My example is a service wi...

How To Mock Dependencies With Jest
Frontend·

How To Mock Dependencies With Jest

When we want to test our code, some things have dependencies inside, and you don't want to call this stuff. You won't be sure your code works, not external dependencies or external code unrelated to my code. Today we will add tests to our example wea...

Get start with Typescript and Parcel
Frontend·

Get start with Typescript and Parcel

Typescript is a technology that grows every day. Companies like Slack, Airbnb, or Google are changing their javascript codebase to Typescript. Frameworks like Vue, React, and (Angular) are using Typescript for writing maintainable code. These steps s...

How to simplify and organize imports in Typescript
Frontend·

How to simplify and organize imports in Typescript

Sometimes we have a long list of imports, with files that come from the same place, it makes our code noisy and a bit longer, something like: import { BeersService } from './services/beers.service'; import { WhiskyService } from './services/whiski....

How To Use Angular Resolvers
Frontend·

How To Use Angular Resolvers

When we go to a party, I love to have all beers ready to drink and take one, but sometimes taking time to pick from the fridge to the table and stay waiting is not a good experience. The same happens with our users working with our angular apps; we s...

How to Manage Global Objects in Angular: Best Practices
Frontend·

How to Manage Global Objects in Angular: Best Practices

When we use external libraries, it is widespread to declare and use a global object. But the price to pay is to get a complex testing scenario and, of course global an object like magic is not a “good practice”. How do you tell Angular about an exter...

A Guide to Content Projection in Angular: Step-by-Step
Frontend·

A Guide to Content Projection in Angular: Step-by-Step

One of the simplest dishes to prepare is a burger. Though the base remains the same, its contents can vary – so let's create our versatile burger component. Today we explain how to use ng content to provide an area flexible and multiple slots. Use n...

Angular Component Theming: A Beginner's Guide
Frontend·

Angular Component Theming: A Beginner's Guide

When we build components, it needs to be flexible, because they can be used in many places or contexts, sometimes changing layout and colors. For example, Our customer wants a list of contacts; it needs to show as a card with the picture, name, and d...

Understanding One-Way and Two-Way Data Binding in Angular
Frontend·

Understanding One-Way and Two-Way Data Binding in Angular

Today I was helping a new guy in angular with differences between the bind data because it provides 2 ways to move data to DOM, One-way and two-way data binding. It helps us to build dynamic apps. It binds the data from our component to the DOM, unid...

Getting Started with Server-Side Rendering in Angular
Frontend·

Getting Started with Server-Side Rendering in Angular

Last month I set up my blog with Angular Universal (Server Side Render); this is about my steps in installing SSR in my blog, so keep in mind a simple blog with only text with HTTP requests to contentful, so it is a real scenario, but the simple case...

Refactor your code using renaming Imports
Frontend·

Refactor your code using renaming Imports

I'm refactoring an Angular code, and I need to have the same filenames while finishing the refactor. My solution was to rename my imports. It is a great way to use a different name or alias for my classes and modules. For example, you can import a si...

How to measure javascript code with performance.now()
Frontend·

How to measure javascript code with performance.now()

Sometimes, we want to know how is the performance or time spent in some function or process can be solved using performance.now(). performance.now() help us get time in milliseconds, and we can measure the time between some function completing his pr...

How to Test Errors with Jest in Typescript
Frontend·

How to Test Errors with Jest in Typescript

I'm continuing with Jest and typescript, we already know how to expect and assert variables and objects in our code, next step is handling errors. The Calculator has a new requirement if the type of calculation is not +,- or / we need to throw an err...

How to use CSS Animation with examples
Frontend·

How to use CSS Animation with examples

I continue fixing my CSS weakness and today is time for the CSS Animation. CSS helps us create animation using the keyword @keyframes, it helps to set the initial state for properties and the amount of time it will get during the animation. We chang...

How to use transitions and transform in CSS
Frontend·

How to use transitions and transform in CSS

Another good way to add great effects with CSS is using transitions, it helps to transform CSS properties from one to other smoothly with duration between them. The two keys properties to get it are: transition-property: set which property we want t...

How to use CSS Gradients to create images effects.
Frontend·

How to use CSS Gradients to create images effects.

Sometimes we want to add the effect of a nice color into our page images. The CSS gradients can help to do it. If you didn't work before with gradients, no problem, I will give a quick overview of it. The CSS gradient helps us to define smooth transi...

How to learn CSS Positions with examples
Frontend·

How to learn CSS Positions with examples

If you are a front-end developer, knowing to position elements with css is critical knowledge. CSS has five position types. I will try to write a small example with each of them. Every CSS Position example use the following HTML structure <main> ...

How to use CSS Pseudo Elements
Frontend·

How to use CSS Pseudo Elements

Sometimes style a specific part of an HTML element like the first letter of h1 or append at begin or after, style the first line, my default solution is use JavaScript but not is the best approach if CSS provide a way to solve with Pseudo elements. T...

How to use CSS Pseudo classes with examples
Frontend·

How to use CSS Pseudo classes with examples

I continue fixing my CSS weakness, and today is time for the Pseudo-classes. The Pseudo-classes help us to define a particular state of an element. The pseudo-class are determined using : maybe you are used before with links with something like a:ho...

How to use CSS Combinators with examples
Frontend·

How to use CSS Combinators with examples

I continue fixing my CSS weakness, and today is time for the CSS Combinators. Sometimes, we want to select elements without affecting others and understand the critical relationship between elements. The CSS Combinators help to write a better CSS sel...

How to configure Ubuntu for Javascript coding.
Frontend·

How to configure Ubuntu for Javascript coding.

Sometimes I reset the Ubuntu sandbox and install it all again. Everything is not an easy task. I present the list of my apps, packages, extensions for Setup. My development box focuses on Javascript (Angular/Typescript ) and Ubuntu (but it can work i...

The Typescript compiler and the tsconfig
Frontend·

The Typescript compiler and the tsconfig

I want to show a small overview of the typescript compiler, and the tsc is responsible for compiling our typescript code, watching changes, code checking, and more. The tsc accept parameters on the execution process can read the configuration from th...

Use fancy imports with path mapping in tsconfig
Frontend·

Use fancy imports with path mapping in tsconfig

In typescript or Angular apps, we can avoid having ugly paths like the following example. import { BookMark } from 'src/app/models/bookmark'; import { BookmarksState } from './../../../state/bookmarks.state'; import { GetBookMark } from './../../../s...

How To Head Start with Testing in Angular with Jasmine
Frontend·

How To Head Start with Testing in Angular with Jasmine

I worked for several months with Jest and Vue, but nowadays, I'm working with Angular, and the testing is part of my learning process. I will explain a bit about Jasmine and how to write a test for typescript classes. If you find something wrong, ple...

Managing Angular CLI Versions: Tips and Tricks
Frontend·

Managing Angular CLI Versions: Tips and Tricks

By default, installing angular-CLI gets the latest version, but sometimes we work with projects built in an old version. To downgrade your current angular-cli, follow these steps. Remove angular-cli sudo npm uninstall -g @angular/cli npm cache clean ...

How to center elements using the box model
Frontend·

How to center elements using the box model

A common task for web development is center elements. We can center the elements horizontally and vertically. Center horizontal Center horizontally is so accessible. Our element needs to have a width size. If not, our element will take all space poss...

How to run multiple npm scripts with npm-run-all
Frontend·

How to run multiple npm scripts with npm-run-all

Sometimes we need to run a fake API with JSON-Server and SPA at the same time. We need to run each command, one for our spa vue serve or ng serve and the other for json-server json-server /db.json One solution is with concatenating each command usi...

Using Class Decorators in Typescript with a real example
Frontend·

Using Class Decorators in Typescript with a real example

The Decorators are an excellent Typescript feature; maybe you see them all over Angular and other frameworks. It helps to write code clean and declarative, maybe you already use it every day, but do you know when to create your decorators? I will s...

Interfaces in Typescript with an Example
Frontend·

Interfaces in Typescript with an Example

The interface is an excellent Typescript feature and helps to write structured and explicit code. The interface helps you describe a structure like fields without values or methods without implementation and forces objects and classes to have. Interf...

Abstract Classes in Typescript
Frontend·

Abstract Classes in Typescript

In Typescript, the classes can inherit from another class to share methods and properties between classes. Also, Typescript support abstract class. Let me show you why and when to use it. For example, we have a base class Subscription and create the ...

Getter and Setter with Typescript
Frontend·

Getter and Setter with Typescript

The encapsulation is an essential part of OOP, and Typescript support gets and sets keywords for members of classes. The encapsulation can be used with the get and set keywords before a function name, then using it. We can encapsulate some logic and ...

How to create type definitions
Frontend·

How to create type definitions

If there is one thing I have to admit, it is that Typescript allows us to feel in control in javascript and that is also thanks to the typings (tsd), but some libraries don't have the typings, I have found myself in need of writing the typings of the...

The functions in Typescript
Frontend·

The functions in Typescript

The Typescript language understands the functions return type by default; for example, in the following example, the compiler understands one return boolean and the other is void. function Auth() { return true } function Auth() { console.log("he...

Using Typescript Types
Frontend·

Using Typescript Types

Typescript comes with its types, and each one is part of typescript, not javascript. Typescript will provide these types as part of our development process, notify the compiler of the data type used, and force us to implement them appropriately. Tupl...

Using type Annotations in Typescript Functions
Frontend·

Using type Annotations in Typescript Functions

I am starting to move to Typescript. I discover how works type annotations in typescript functions. Let start by showing a few things I learned today about Typescript. Typescript allows type annotation in function parameters and returns types. Types ...

Typescript and primitive Types
Frontend·

Typescript and primitive Types

I am starting to move to Typescript. I discover how it works and different ways to use them with Typescript. Typescript is a superset running up to Javascript, and it supports all primitive types. Let start by showing a few things I learned today abo...