<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by E Faridzolghadr on Medium]]></title>
        <description><![CDATA[Stories by E Faridzolghadr on Medium]]></description>
        <link>https://medium.com/@e.faridzolghadr?source=rss-918367e14c53------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-oZpwk2hagcy3ofkvJmpNw.jpeg</url>
            <title>Stories by E Faridzolghadr on Medium</title>
            <link>https://medium.com/@e.faridzolghadr?source=rss-918367e14c53------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:02:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@e.faridzolghadr/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating a Circular Progress Component in Angular]]></title>
            <link>https://medium.com/@e.faridzolghadr/creating-a-circular-progress-component-in-angular-8a0f338bbfac?source=rss-918367e14c53------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a0f338bbfac</guid>
            <dc:creator><![CDATA[E Faridzolghadr]]></dc:creator>
            <pubDate>Sun, 09 Feb 2025 06:07:35 GMT</pubDate>
            <atom:updated>2025-02-09T06:07:35.248Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4QUuWzI7etHnBLtkArF-9g.jpeg" /></figure><h3>Introduction</h3><p>Progress indicators play a crucial role in enhancing user experience by providing visual feedback on ongoing operations. One such common UI element is the circular progress indicator, which is widely used to display task progress, completion status, or other metrics. In this article, we will build a <strong>custom Circular Progress component</strong> in Angular that is highly customizable and efficient.</p><h3>Implementing the Circular Progress Component</h3><h4>Step 1: Creating the Component</h4><p>First, let’s create the CircularProgressComponent using Angular&#39;s component-based architecture.</p><pre>import { Component, Input, OnChanges, SimpleChanges } from &quot;@angular/core&quot;;<br><br>@Component({<br>  selector: &quot;app-circular-progress&quot;,<br>  templateUrl: &quot;./circular-progress.component.html&quot;,<br>  styleUrls: [&quot;./circular-progress.component.scss&quot;],<br>})<br>export class CircularProgressComponent implements OnChanges {<br>  @Input() value: number = 0;<br>  @Input() isPercentage: boolean = false;<br>  @Input() isRoundClock: boolean = true;<br>  @Input() min: number = 0;<br>  @Input() max: number = 100;<br>  @Input() size: number = 120;<br>  @Input() thresholds: { value: number; color: string }[] = [];<br><br>  strokeDasharray: string = &quot;&quot;;<br>  strokeDashoffset: string = &quot;&quot;;<br>  progressColor: string = &quot;var(--color-default)&quot;;<br><br>  ngOnChanges(changes: SimpleChanges) {<br>    this.updateProgress();<br>  }<br><br>  updateProgress() {<br>    const radius = 45;<br>    const circumference = 2 * Math.PI * radius;<br>    const percentage = ((this.value - this.min) / (this.max - this.min)) * 100;<br>    const progress = (circumference * (100 - percentage)) / 100;<br><br>    this.strokeDasharray = `${circumference} ${circumference}`;<br>    this.strokeDashoffset = progress.toString();<br>    this.progressColor = this.getThresholdColor(percentage);<br>  }<br><br>  getThresholdColor(percentage: number): string {<br>    let selectedColor = &quot;var(--color-default)&quot;;<br>    for (let threshold of this.thresholds) {<br>      if (percentage &lt;= threshold.value) {<br>        selectedColor = threshold.color;<br>        break;<br>      }<br>    }<br>    return selectedColor;<br>  }<br>}</pre><h4>Step 2: Defining the Template</h4><p>The template consists of an SVG element that visually represents the circular progress indicator.</p><pre>&lt;svg<br>  [attr.width]=&quot;size&quot;<br>  [attr.height]=&quot;size&quot;<br>  viewBox=&quot;0 0 100 100&quot;<br>  [style.--progress-color]=&quot;progressColor&quot;<br>&gt;<br>  &lt;circle<br>    cx=&quot;50&quot;<br>    cy=&quot;50&quot;<br>    r=&quot;45&quot;<br>    stroke=&quot;var(--color-bg, #ddd)&quot;<br>    stroke-width=&quot;10&quot;<br>    fill=&quot;none&quot;<br>  /&gt;<br>  <br>  &lt;circle<br>    *ngIf=&quot;isRoundClock&quot;<br>    cx=&quot;50&quot;<br>    cy=&quot;50&quot;<br>    r=&quot;45&quot;<br>    fill=&quot;none&quot;<br>    stroke-width=&quot;10&quot;<br>    stroke=&quot;var(--progress-color, green)&quot;<br>    [attr.stroke-dasharray]=&quot;strokeDasharray&quot;<br>    [attr.stroke-dashoffset]=&quot;strokeDashoffset&quot;<br>    stroke-linecap=&quot;round&quot;<br>    transform=&quot;rotate(-90 50 50)&quot;<br>  /&gt;<br>  <br>  &lt;text<br>    x=&quot;50&quot;<br>    y=&quot;55&quot;<br>    text-anchor=&quot;middle&quot;<br>    font-size=&quot;24px&quot;<br>    fill=&quot;var(--color-text, #333)&quot;<br>    text-decoration=&quot;underline&quot;<br>  &gt;<br>    {{ isPercentage ? &quot;%&quot; : &quot;&quot; }} {{ value }}<br>  &lt;/text&gt;<br>&lt;/svg&gt;</pre><h4>Step 3: Styling the Component</h4><p>To ensure smooth animations and responsiveness, let’s define the styles in SCSS.</p><pre>svg {<br>  display: block;<br>  margin: auto;<br>}<br><br>circle {<br>  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;<br>}</pre><h4>Step 4: Using the Component</h4><p>Now, we can use our newly created CircularProgressComponent in an Angular template by providing the necessary inputs.</p><pre>&lt;app-circular-progress<br>  [value]=&quot;30&quot;<br>  [min]=&quot;0&quot;<br>  [max]=&quot;100&quot;<br>  [size]=&quot;40&quot;<br>  [isPercentage]=&quot;true&quot;<br>  [thresholds]=&quot;[<br>    { value: 30, color: &#39;var(--danger)&#39; },<br>    { value: 70, color: &#39;var(--orange)&#39; },<br>    { value: 80, color: &#39;var(--success)&#39; }<br>  ]&quot;<br>&gt;<br>&lt;/app-circular-progress&gt;</pre><h3>Conclusion</h3><p>We successfully built a <strong>fully customizable Circular Progress component</strong> in Angular. This component allows us to visualize progress with different colors based on threshold values and provides smooth animations. By leveraging SVGs and Angular’s reactive capabilities, we ensure that the component is both lightweight and highly adaptable to various UI needs.</p><p>This Circular Progress component can be enhanced further by adding more custom styling options, animations, and even tooltips for better user experience. Try it out and integrate it into your Angular applications to improve your UI!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a0f338bbfac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing Angular Applications with Route Animations]]></title>
            <link>https://medium.com/@e.faridzolghadr/enhancing-angular-applications-with-route-animations-396ba9ee6f24?source=rss-918367e14c53------2</link>
            <guid isPermaLink="false">https://medium.com/p/396ba9ee6f24</guid>
            <dc:creator><![CDATA[E Faridzolghadr]]></dc:creator>
            <pubDate>Sat, 25 Jan 2025 12:53:11 GMT</pubDate>
            <atom:updated>2025-01-25T12:53:11.098Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oDM4FtSLc4YYuP1bD9gShg.jpeg" /></figure><h3>Introduction</h3><p>In modern web applications, user experience is a key factor that can set your application apart from the competition. Smooth transitions and visually engaging animations not only enhance usability but also create a polished, professional feel. One such area where animations can make a significant impact is during route changes in Angular applications. Angular provides a robust <a href="http://twitter.com/angular/animations">@angular/animations</a> module that makes it easy to implement animations for route transitions.</p><p>In this article, we will explore the steps to add animations to your Angular application’s routes, discuss common challenges (like issues with &lt;a&gt; tags and routerLink), and provide practical solutions. By the end of this guide, you’ll be equipped with the knowledge to create seamless route animations that enhance your users’ experience.</p><h3>Why Use Route Animations?</h3><p>Route animations are more than just eye candy; they serve several practical purposes:</p><p>1.Improved User Experience: Animations guide users through the application by providing a visual cue that something is changing, reducing cognitive load.</p><p>2.Polished Aesthetic: A smooth transition between routes gives the application a more professional and modern appearance.</p><p>3.Context Preservation: Animations help users maintain context when navigating between pages, especially in complex applications.</p><p>4.Feedback Mechanism: They act as visual feedback, reassuring users that their action (e.g., clicking a link) is being processed.</p><p>Now that we understand the value of route animations, let’s dive into implementing them.</p><h3>Step-by-Step Guide to Adding Route Animations</h3><ol><li><strong>Install Angular Animations Module</strong></li></ol><p>To start, ensure that <a href="http://twitter.com/angular/animations">@angular/animations</a> is installed in your project. If it’s not already installed, run:</p><pre>npm install @angular/animations</pre><p>Then, import the BrowserAnimationsModule in your AppModule:</p><pre>import { BrowserAnimationsModule } from &#39;@angular/platform-browser/animations&#39;;<br><br>@NgModule({<br>  declarations: [ /* ... */ ],<br>  imports: [<br>    /* Other modules */<br>    BrowserAnimationsModule,<br>  ],<br>  bootstrap: [AppComponent],<br>})<br>export class AppModule {}</pre><p><strong>2. Define Animations</strong></p><p>Define your route animations using Angular’s trigger and transition methods. For example, the following animation smoothly fades in content during route changes:</p><pre>import { trigger, transition, style, animate } from &#39;@angular/animations&#39;;<br><br>@Component({<br>  selector: &#39;app-root&#39;,<br>  templateUrl: &#39;./app.component.html&#39;,<br>  styleUrls: [&#39;./app.component.scss&#39;],<br>  animations: [<br>    trigger(&#39;routeAnimation&#39;, [<br>      transition(&#39;* &lt;=&gt; *&#39;, [<br>        style({ opacity: 0, transform: &#39;translateY(20px)&#39; }),<br>        animate(&#39;300ms ease-out&#39;, style({ opacity: 1, transform: &#39;translateY(0)&#39; }))<br>      ]),<br>    ]),<br>  ],<br>})<br>export class AppComponent {}</pre><p><strong>3. Apply Animation to Router Outlet</strong></p><p>To attach the animation to route transitions, use the [<a href="http://twitter.com/triggerName">@triggerName</a>] syntax on the &lt;router-outlet&gt; element:</p><pre>&lt;main [@routeAnimation]=&quot;getRouteState(outlet)&quot;&gt;<br>  &lt;router-outlet #outlet=&quot;outlet&quot;&gt;&lt;/router-outlet&gt;<br>&lt;/main&gt;</pre><p>In the component, define the getRouteState method to determine the current route state:</p><pre>getRouteState(outlet: any): string {<br>  return outlet.isActivated ? outlet.activatedRoute.snapshot.url.join(&#39;/&#39;) : &#39;&#39;;<br>}</pre><p><strong>4. Handling Issues with &lt;a&gt; and routerLink</strong></p><p>When using &lt;a&gt; tags with routerLink, you might encounter issues where animations fail to trigger properly. This happens because &lt;a&gt; tags can trigger the browser’s default behavior, bypassing Angular’s routing mechanism. Here are some solutions:</p><p>a. Use routerLinkActive</p><p>Ensure Angular handles the navigation fully by adding routerLinkActive:</p><pre>&lt;a class=&quot;link-nav return-btn&quot; [routerLink]=&quot;[&#39;/target-route&#39;]&quot; routerLinkActive=&quot;active&quot;&gt;Go Back&lt;/a&gt;</pre><p>b. Replace &lt;a&gt; with &lt;button&gt;</p><p>For more control, replace &lt;a&gt; tags with &lt;button&gt; and manually trigger navigation:</p><pre>&lt;button class=&quot;link-nav return-btn&quot; (click)=&quot;navigateToTarget()&quot;&gt;Go Back&lt;/button&gt;</pre><p>In the component:</p><pre>import { Router } from &#39;@angular/router&#39;;<br><br>constructor(private router: Router) {}<br><br>navigateToTarget() {<br>  this.router.navigate([&#39;/target-route&#39;]);<br>}</pre><p>c. Disable Default Behavior in &lt;a&gt;</p><p>If you must use &lt;a&gt; tags, disable their default behavior by setting href to javascript:void(0):</p><pre>&lt;a class=&quot;link-nav return-btn&quot; [routerLink]=&quot;[&#39;/target-route&#39;]&quot; href=&quot;javascript:void(0);&quot;&gt;Go Back&lt;/a&gt;</pre><p><strong>5. Custom Animations for Specific Routes</strong></p><p>You can customize animations for specific routes using route data. Define route data in the AppRoutingModule:</p><pre>const routes: Routes = [<br>  { path: &#39;home&#39;, component: HomeComponent, data: { animation: &#39;HomePage&#39; } },<br>  { path: &#39;about&#39;, component: AboutComponent, data: { animation: &#39;AboutPage&#39; } },<br>];</pre><p>Update the getRouteState method:</p><pre>getRouteState(outlet: any): string {<br>  return outlet.isActivated ? outlet.activatedRouteData[&#39;animation&#39;] : &#39;&#39;;<br>}</pre><p>Customize animations based on route transitions:</p><pre>trigger(&#39;routeAnimation&#39;, [<br>  transition(&#39;HomePage =&gt; AboutPage&#39;, [<br>    style({ opacity: 0, transform: &#39;translateX(-100%)&#39; }),<br>    animate(&#39;300ms ease-out&#39;, style({ opacity: 1, transform: &#39;translateX(0)&#39; }))<br>  ]),<br>  transition(&#39;AboutPage =&gt; HomePage&#39;, [<br>    style({ opacity: 0, transform: &#39;translateX(100%)&#39; }),<br>    animate(&#39;300ms ease-out&#39;, style({ opacity: 1, transform: &#39;translateX(0)&#39; }))<br>  ]),<br>]);</pre><h3>Conclusion</h3><p>Adding animations to route transitions in Angular applications is a powerful way to improve user experience and create a polished, professional feel. By leveraging Angular’s @angular/animations module, you can implement smooth, visually engaging transitions that enhance usability and provide valuable feedback to users.</p><p>Whether you’re building a simple app or a complex enterprise solution, route animations can make your application stand out. Start experimenting today, and see the difference it makes!</p><p>Do you have tips or experiences with Angular route animations? Share them in the comments below!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=396ba9ee6f24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Custom Toast Notification System in Angular Without External Libraries]]></title>
            <link>https://medium.com/@e.faridzolghadr/building-a-custom-toast-notification-system-in-angular-without-external-libraries-3149ccc82615?source=rss-918367e14c53------2</link>
            <guid isPermaLink="false">https://medium.com/p/3149ccc82615</guid>
            <dc:creator><![CDATA[E Faridzolghadr]]></dc:creator>
            <pubDate>Sun, 05 Jan 2025 05:30:38 GMT</pubDate>
            <atom:updated>2025-01-05T05:37:27.426Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SmFcOj2l9qt3WYZcAvESxA.jpeg" /></figure><p>Toast notifications are essential for enhancing user experience by providing quick feedback or updates without interrupting the workflow. While several libraries offer pre-built solutions, creating your custom toast notification system has its advantages, such as full customization and control over the design and functionality.</p><p>In this article, we’ll walk through building a custom toast notification system in Angular step by step, without relying on any external libraries. By the end, you’ll have a reusable and extendable solution tailored to your specific project needs.</p><h4><strong>Why Build a Custom Toast System?</strong></h4><p>Creating a custom toast system allows you to:</p><ol><li>Avoid dependency on third-party libraries, reducing bundle size.</li></ol><p>2. Tailor the design to match your application’s branding.</p><p>3. Have complete control over functionality and animations.</p><p>4. Avoid issues related to library updates or deprecations.</p><p>Now, let’s dive into the implementation.</p><h4>Step 1: Define the Toast Model</h4><p>We begin by defining a TypeScript interface for our toast notifications. This ensures a consistent structure and facilitates type checking.</p><pre>export interface ToastModel {<br>  message: string; // The toast message<br>  title?: string; // Optional toast title<br>  type: &#39;success&#39; | &#39;danger&#39; | &#39;warning&#39; | &#39;info&#39;; // Toast type<br>  duration?: number; // Display duration in milliseconds<br>  position?: &#39;top-right&#39; | &#39;top-left&#39; | &#39;bottom-right&#39; | &#39;bottom-left&#39;; // Position on screen<br>  isRemoving?: boolean; // State for removal animation<br>  closeable?: boolean; // Whether the toast is dismissible<br>}</pre><h4>Step 2: Create the Toast Service</h4><p>The service manages the list of toasts and provides methods to show or remove them. We use BehaviorSubject to keep track of the toast list and allow real-time updates to the component.</p><pre>import { Injectable } from &#39;@angular/core&#39;;<br>import { BehaviorSubject } from &#39;rxjs&#39;;<br>import { ToastModel } from &#39;./model&#39;;<br><br>@Injectable({<br>  providedIn: &#39;root&#39;,<br>})<br>export class ToastService {<br>  private toastsSubject = new BehaviorSubject&lt;ToastModel[]&gt;([]);<br>  toasts$ = this.toastsSubject.asObservable();<br><br>  get toasts(): ToastModel[] {<br>    return this.toastsSubject.value;<br>  }<br><br>  showToast(toast: ToastModel) {<br>    const updatedToasts = [...this.toasts, toast];<br>    this.toastsSubject.next(updatedToasts);<br><br>    const duration = toast.duration ?? 5000; // Default duration: 5 seconds<br>    setTimeout(() =&gt; this.removeToast(toast), duration);<br>  }<br><br>  removeToast(toast: ToastModel) {<br>    const updatedToasts = this.toasts.filter((t) =&gt; t !== toast);<br>    this.toastsSubject.next(updatedToasts);<br>  }<br>}</pre><h4>Step 3: Create the Toast Component</h4><p>The component subscribes to the toasts$ observable and renders the list of toasts dynamically. It also handles user interactions, such as dismissing a toast.</p><p><strong>Component TypeScript:</strong></p><pre>import { Component, inject, OnDestroy, OnInit } from &#39;@angular/core&#39;;<br>import { ToastModel } from &#39;./model&#39;;<br>import { ToastService } from &#39;./toast.service&#39;;<br>import { Subscription } from &#39;rxjs&#39;;<br>import { NgClass, NgFor, NgIf } from &#39;@angular/common&#39;;<br><br>@Component({<br>  selector: &#39;app-toast&#39;,<br>  templateUrl: &#39;./toast.component.html&#39;,<br>  styleUrls: [&#39;./toast.component.scss&#39;],<br>  standalone: true,<br>  imports: [NgFor, NgClass, NgIf],<br>})<br>export class ToastComponent implements OnInit, OnDestroy {<br>  private readonly ToastService = inject(ToastService);<br>  toastData: ToastModel[] = [];<br>  ToastObserver: Subscription;<br><br>  ngOnInit(): void {<br>    this.ToastObserver = this.ToastService.toasts$.subscribe((it) =&gt; {<br>      this.toastData = it;<br>    });<br>  }<br><br>  dismissToast(toast: ToastModel): void {<br>    toast.isRemoving = true;<br><br>    setTimeout(() =&gt; {<br>      this.ToastService.removeToast(toast);<br>    }, 500); // Animation duration<br>  }<br><br>  getPositionClass(position: ToastModel[&#39;position&#39;]): string {<br>    return position || &#39;top-right&#39;; // Default position<br>  }<br><br>  ngOnDestroy(): void {<br>    this.ToastObserver.unsubscribe();<br>  }<br>}</pre><p><strong>Component HTML:</strong></p><pre>&lt;div [ngClass]=&quot;[&#39;toaster&#39;, getPositionClass(toastData[0]?.position)]&quot;&gt;<br>  &lt;div<br>    class=&quot;toast&quot;<br>    *ngFor=&quot;let toast of toastData&quot;<br>    [ngClass]=&quot;[<br>      toast?.type,<br>      toast?.isRemoving ? &#39;toast-exit&#39; : &#39;toast-animate&#39;<br>    ]&quot;<br>  &gt;<br>    &lt;div class=&quot;toast-header&quot;&gt;<br>      &lt;span class=&quot;toast-title&quot; *ngIf=&quot;toast?.title&quot;&gt;{{ toast?.title }}&lt;/span&gt;<br>      &lt;span<br>        class=&quot;material-icons toast-close&quot;<br>        (click)=&quot;dismissToast(toast)&quot;<br>        *ngIf=&quot;toast?.closeable&quot;<br>      &gt;<br>        close<br>      &lt;/span&gt;<br>    &lt;/div&gt;<br>    &lt;div class=&quot;toast-message&quot;&gt;<br>      {{ toast?.message }}<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p><strong>Component SCSS:</strong></p><pre>.toaster {<br>  position: fixed;<br>  z-index: 1000;<br>  display: flex;<br>  flex-direction: column;<br>  gap: 10px;<br><br>  &amp;.top-right {<br>    top: 10px;<br>    right: 10px;<br>  }<br><br>  &amp;.top-left {<br>    top: 10px;<br>    left: 10px;<br>  }<br><br>  &amp;.bottom-right {<br>    bottom: 10px;<br>    right: 10px;<br>  }<br><br>  &amp;.bottom-left {<br>    bottom: 10px;<br>    left: 10px;<br>  }<br><br>  .toast {<br>    padding: 10px 20px;<br>    border-radius: 5px;<br>    color: white;<br>    cursor: pointer;<br>    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);<br>    opacity: 0;<br>    transform: translateY(-20px);<br>    transition: opacity 0.5s ease, transform 0.5s ease;<br><br>    &amp;.toast-exit {<br>      opacity: 0;<br>      transform: translateY(-20px);<br>    }<br><br>    &amp;.toast-animate {<br>      opacity: 1;<br>      transform: translateY(0);<br>    }<br><br>    &amp;.success {<br>      background-color: var(--sucess-4);<br>    }<br><br>    &amp;.danger {<br>      background-color: var(--danger-5);<br>    }<br><br>    &amp;.warning {<br>      background-color: var(--primary-3);<br>      color: var(--neutral-10);<br>    }<br><br>    &amp;.info {<br>      background-color: var(--info-4);<br>    }<br><br>    &amp;:hover {<br>      opacity: 1;<br>    }<br><br>    .toast-header {<br>      display: flex;<br>      justify-content: space-between;<br>      align-items: center;<br><br>      .toast-title {<br>        font-weight: bold;<br>      }<br><br>      .toast-close {<br>        cursor: pointer;<br>        font-size: 18px;<br>        margin-left: 10px;<br>      }<br>    }<br><br>    .toast-message {<br>      margin-top: 5px;<br>      text-align: right;<br>      direction: rtl;<br>    }<br><br>    .material-icons{<br>      margin-left: 0px !important;<br>    }<br>  }<br>}</pre><h4>Step 4: Use the Toast Component</h4><p>To include the toast component in your application, add it to the app.component.html file:</p><pre>&lt;app-toast&gt;&lt;/app-toast&gt;</pre><p>To trigger a toast notification, call the showToast method from the ToastService:</p><pre>this.ToastService.showToast({<br>  message: &#39;This is a success message!&#39;,<br>  title: &#39;Success&#39;,<br>  type: &#39;success&#39;,<br>  position: &#39;bottom-left&#39;,<br>  duration: 3000,<br>  closeable: true,<br>});</pre><h4>Conclusion</h4><p>Creating a custom toast notification system in Angular is not only a great learning experience but also provides flexibility and control over design and behavior. With this implementation, you can easily extend the functionality by adding new types, animations, or features. By avoiding external libraries, you ensure long-term maintainability and adaptability of your code.<br>I would be happy if you could share your thoughts with me on <a href="https://www.linkedin.com/in/farid-zolghadr-767b4490/">LinkedIn</a>.</p><p>Feel free to customize this system further to meet your project’s unique requirements. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3149ccc82615" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>