Author: Andreas Plahn
Angular Signals: Complete Guide
A complete guide on how to use Signals in an Angular application. Learn signals, their benefits, best practices, and patterns, and avoid the most common pitfalls.
Source: Angular Signals: Complete Guide
Four ways of listening to DOM events in Angular (Part 2: @HostListener)
So now how about listening to events on the host element that wraps the component’s template? How can we do that properly in Angular apps? That’s the very question we will answer in this article. Before diving directly into listening to DOM events on a host element, I think we need to touch on what a host element is. The concept of host element applies not only to components but also attribute directives.
Source: Four ways of listening to DOM events in Angular (Part 2: @HostListener)
File Utils – Visual Studio 2022 show file encoding extension
Show file encoding and absolute path at the bottom of each editor, click to copy the path or change the file encoding.
Zod – Typescript based validation library
Zod is designed to be as developer-friendly as possible. The goal is to eliminate duplicative type declarations. With Zod, you declare a validator once and Zod will automatically infer the static TypeScript type. It’s easy to compose simpler types into complex data structures.
zod.dev/?id=basic-usage
SPARTAN. Type-safe Angular full-stack development powered by Analog. – DEV Community
How to build your own SAAS business
Read more:
dev.to/kwnaidoo/how-to-build-your-own-saas-business-2op0
Pico.css • Minimal CSS Framework for semantic HTML
picocss.com/
Super Useful CSS Resources 🌈 – DEV Community
dev.to/lissy93/super-useful-css-resources-1ba3
How to set width for table columns in CSS
Tables in html behaves differently than other elements on a page since the table, rows, th and td elements are displayed in a special way. The column width is automatically adjusted based on the content.
Here is a trick to set the column width using the colgroup element which affects both the th and td at once.
A table with 3 columns and 2 rows:
<table> <colgroup> <col class="col-select" /> <col class="col-product" /> <col class="col-country" /> </colgroup> <thead> <tr> <th>Select</th> <th>Product</th> <th>Country</th> </tr> </thead> <tbody> <tr> <td><input type="checkbox">Select</td> <td>Product 1</td> <td>Sweden</td> </tr> <tr> <td><input type="checkbox">Select</td> <td>Product 2</td> <td>Norway</td> </tr> </tbody> </table>
We have 3 columns: Select, Product and Country
To set the widths we use css classes col-select and so on.
.col-select { width: 1%; } .col-product { width: 75%; } .col-country { width: 24%; }
Here we set the select to be as “narrow” as possible (1%). And the others to relative % numbers.
To further “force” the widths we should allow long words to be wrapped, e.g add the following css class for the columns you wish this behavior for:
.text-break { overflow-wrap: break-word; }
Usage:
<colgroup> <col class="col-select" /> <col class="col-product text-break" /> <col class="col-country text-break" /> </colgroup>