Angular 🇺🇦 - practical notes
Kanalga Telegram’da o‘tish
Angular - practical notes This group is for posting practical notes for Angular developers. Mostly all posts are for quick implementation https://t.me/angular_practical_notes (Commenting on posts only in ENG and UA langs here). Welcome!
Ko'proq ko'rsatish1 631
Obunachilar
Ma'lumot yo'q24 soatlar
+17 kun
Ma'lumot yo'q30 kun
Postlar arxiv
Hey 👋
Our chat is open for various discussions about Angular and more!
https://t.me/angular_practical_notes_chat
📄 Angular v17 with TanStack Angular Query
#angular #guide #TanStack
Managing API interactions in Angular projects often involves repetitive logic, leading to code duplication, increased maintenance burden, and potential state management complexities. While "@ tanstack/angular-query-experimentaloffers" a robust solution, it's important to note that this package is still under experimental development. Instead, for Angular v17 projects specifically, consider utilizing the stable "@ tanstack/angular-query-experimental" package.
$ npm install @tanstack/query-angular-experimental @tanstack/angular-query-devtools-experimental
🔗 TanStack link ✅ Article link 🎁 Code LinkOne more poll for today.
Currently in the development of a emoji pack for visual accompaniment of articles and additional content for a paid sub of 5$/mo (huge articles and mini projects, this decision won't affect the old approach of publications).
Hello everybody! Our channel is growing every day, which makes me start investing more tine in the channel. By the way, I decided to update the logo. Please share your thoughts on the new logo.
🧪 Attribute Injection in Angular: The HostAttributeToken Approach
#angular #decorator #attribute
Angular offers the @ Attribute decorator, facilitating the injection of attributes from the host node. It proves particularly handy when there’s no necessity to establish a binding.🚩 > Angular 17.3 ✅ Article link
📄 Deactivate Route Guards in Angular
#angular #guard #ui_element
The CanDeactivate route guard in Angular is responsible for determining if a route can be deactivated. It is commonly used when you want to check if the user is allowed to leave a particular component or route, perhaps due to unsaved changes or other dynamic conditions.✅ Article link
📄 Angular, Docker & Nginx: Build once, Deploy anywhere
#angular #guide #TanStack
Managing API interactions in Angular projects often involves repetitive logic, leading to code duplication, increased maintenance burden, and potential state management complexities. While @tanstack/angular-query-experimentaloffers a robust solution, it's important to note that this package is still under experimental development. Instead, for Angular v17 projects specifically, consider utilizing the stable @tanstack/angular-query-experimental package.
$ npm install @tanstack/query-angular-experimental @tanstack/angular-query-devtools-experimental
🔗 TanStack link ✅ Article link 🎁 Code Link📄 How to Set Up SonarQube with Angular
#angular #sonarqube
SonarQube is a powerful open-source platform that allows developers to assess and enhance the quality of their code. By providing insights into code issues, maintainability, and adherence to coding standards, SonarQube helps maintain code integrity and improve overall software quality. In this article, we will guide you through the process of setting up SonarQube for your Angular application, ensuring that you can continuously monitor and enhance your codebase.🔗SonarQube link ✅ Article link
🫠 Circular References in JavaScript
#js #info #BestPractics
...A circular reference, also known as a circular dependency, occurs when two or more objects reference each other in a way that creates an endless loop...Why Circular References Matters: 1. Memory Management: — Circular references can prevent objects from being garbage collected by JavaScript’s memory management system. — This can lead to memory leaks, where memory is consumed unnecessarily, potentially causing your application to slow down or crash. 2. Behavioral Issues: — Circular references can cause unexpected behavior in your code, making it challenging to predict how your program will behave. 3. Debugging Difficulty: — Identifying and debugging issues related to circular references can be complex, especially in large codebases. ✅ Article link
🤓 13 HTML Attributes You Should Know
#html #attributes
...In HTML, attributes are used to provide additional information about HTML elements...✅ Article link
📄 Angular, Docker & Nginx: Build once, Deploy anywhere
#angular #nginx #docker
In software development is quite common to have multiple environments, each with different configurations. Angular offers a built-in system for managing environment variables, allowing for the replacement of files during build time. However, this approach often requires creating separate builds for each environment, which can be time-consuming but to avoid this we have a pretty common pattern in the industry. Build once, deploy anywhere… So, let’s have an example where we have two environments, DEV and PROD, and for that, we want to have ONE build. For that, we use: Angular — a front-end framework for building SPA applications. Nginx — is a web server and reverse proxy server. Docker — is a platform for developing, shipping, and running applications in containers, which are lightweight, portable, and self-sufficient environments.✅ Article link 🎁 Code link
📄 Handling CSS Precedence with
@layer
#css #layer
In web design scenarios, developers typically use multiple CSS selectors and often have to override styles. Even though you don’t override CSS styles with multiple selectors by yourself, every CSS block you write automatically overrides styles from the user-agent stylesheet. CSS’s style overriding process happens based on the browser’s specificity algorithm that calculates a weight for CSS selectors for handling precedence. In the past, every developer tweaked their CSS overriding-related code based on the specificity algorithm since they didn’t have a way to handle CSS precedence without using confusing !important.
📄Modern Component-Oriented Responsive Design with
@container
#css #container
The modern CSS specification offers container queries via the @container at-rule for this requirement.
Look at the following sample:
<div class="alert">
<h3>Lorem ipsum dolor sit amet</h3>
<button>Lorem ipsum</button>
<button>Lorem ipsum</button>
</div>
.alert {
background-color: #ddd;
padding: 12px;
resize: horizontal;
overflow: hidden;
container-type: inline-size;
}
.alert h3 {
padding: 0 0 6px 0;
margin: 0 0 12px 0;
border-bottom: solid 2px #eb7e3b;
}
.alert button {
padding: 12px;
border: none;
margin-right: 6px;
}
@container (width < 400px) {
.alert button {
width: 100%;
box-sizing: border-box;
}
.alert button:not(:last-child) {
margin-bottom: 10px;
}
}📄Defining Scoped CSS with
@scope
#css #scope
By default, the traditional CSS implementation styles web pages with a global scoping concept. Moreover, in the past, no CSS scoping feature was present with the style tag, every style tag was feasible for styling any HTML node, including the root regardless of the style tag position in the DOM tree. The HTML standard tried to support scoping with the scoped attribute, but it was deprecated before becoming a web standard. Now, the modern CSS specification introduced the `scope` at-rule for defining scoped CSS. For example, you can create a scoped style tag for styling an HTML segment as follows:
<div>
<style>
@scope {
:scope {
background-color: #ddd;
padding: 12px;
}
h3 {
padding: 0 0 6px 0;
margin: 0;
border-bottom: solid 2px #eb7e3b;
}
}
</style>
<h3>Lorem ipsum dolor sit amet</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
The above style tag defines a scoped CSS content for the parent div element with @scope. Here, we targeted the scoped element using the :scope pseudo-class.
📄How to setup Angular + Supabase
#angular #supabase
Supabase as a Firebase alternative🔗Supabase link ✅ Article link
