<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Boris Jenicek</title>
    <description>The latest articles on Forem by Boris Jenicek (@borisjenicek).</description>
    <link>https://forem.com/borisjenicek</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F635300%2F8fa54575-6386-4372-ac82-0c7f2aef8830.jpg</url>
      <title>Forem: Boris Jenicek</title>
      <link>https://forem.com/borisjenicek</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/borisjenicek"/>
    <language>en</language>
    <item>
      <title>Angular Techniques: Injecting Singleton Services into Custom Classes</title>
      <dc:creator>Boris Jenicek</dc:creator>
      <pubDate>Wed, 17 Apr 2024 09:48:10 +0000</pubDate>
      <link>https://forem.com/borisjenicek/angular-techniques-injecting-singleton-services-into-custom-classes-58pd</link>
      <guid>https://forem.com/borisjenicek/angular-techniques-injecting-singleton-services-into-custom-classes-58pd</guid>
      <description>&lt;h3&gt;
  
  
  How Angular's Dependency Injection Falls Short for Non-Service Classes
&lt;/h3&gt;

&lt;p&gt;In Angular, dependency injection is primarily designed for services and components, facilitated through decorators like &lt;code&gt;@Injectable()&lt;/code&gt; and &lt;code&gt;@Component()&lt;/code&gt;. These decorators enable Angular to manage the creation and lifecycle of these objects. However, when you step outside this conventional use—into the realm of custom classes that are neither components nor services—you encounter a limitation. Angular's DI can't directly inject dependencies into arbitrary classes. This is where the Service Locator pattern comes into play as a workaround.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up the Angular Service Locator
&lt;/h3&gt;

&lt;p&gt;The Service Locator pattern is essentially a manually created service that can access Angular’s injector itself. It acts as a central registry from which other parts of your application can retrieve dependencies. Here’s how to set it up:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Define the Service Locator Class&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Injector&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@angular/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ServiceLocator&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="nx"&gt;injector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Injector&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Initialize the Service Locator&lt;/strong&gt;:
Create a function to assign the Angular &lt;code&gt;Injector&lt;/code&gt; instance to your &lt;code&gt;ServiceLocator&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;setupServiceLocator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;injector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Injector&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nx"&gt;ServiceLocator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;injector&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;injector&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Register a Provider for Initialization&lt;/strong&gt;:
To ensure that the &lt;code&gt;Injector&lt;/code&gt; is available as soon as possible, you need to register an &lt;code&gt;APP_INITIALIZER&lt;/code&gt; provider in your application module:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ApplicationConfig&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;APP_INITIALIZER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Injector&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@angular/core&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;appConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ApplicationConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="na"&gt;providers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
       &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="na"&gt;provide&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;APP_INITIALIZER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="na"&gt;useFactory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;injector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Injector&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setupServiceLocator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;injector&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
         &lt;span class="na"&gt;deps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Injector&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
         &lt;span class="na"&gt;multi&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt;
     &lt;span class="p"&gt;]&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example: Using Angular Services in a Custom Class
&lt;/h3&gt;

&lt;p&gt;With the Service Locator set up, you can now inject Angular services into any class. Here’s a simple example demonstrating how to use this approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ServiceLocator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./service-locator&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;LoggerService&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./logger.service&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CustomClass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;LoggerService&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ServiceLocator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;injector&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LoggerService&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;CustomClass initialized!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why Use the Service Locator Pattern?
&lt;/h3&gt;

&lt;p&gt;While this approach deviates from the typical Angular DI pattern, it provides a practical solution for extending dependency injection capabilities to any class within your Angular application. It's especially useful in large applications where you need to maintain clean architecture without excessively coupling your classes to Angular's components or services structure.&lt;/p&gt;




&lt;h3&gt;
  
  
  Simplify Angular DI with @ng-vibe/service-locator
&lt;/h3&gt;

&lt;p&gt;If you're a fan of simpler, more streamlined approaches to managing dependency injection in Angular, you might be interested in a library I developed called &lt;a href="https://www.npmjs.com/package/@ng-vibe/service-locator"&gt;@ng-vibe/service-locator&lt;/a&gt;. This library is designed to address the limitations of Angular's dependency injection for non-service classes, providing an elegant solution that supports both accessing singleton services and creating new instances dynamically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features of @ng-vibe/service-locator include:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Static Access to Services:&lt;/strong&gt; Easily retrieve instances of any registered service from anywhere in your application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Service Creation:&lt;/strong&gt; Create new service instances on-the-fly, scoped within their own injectors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplified Service Management:&lt;/strong&gt; Streamlines the use of Angular's injector, making it more accessible and easier to manage across your application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Getting Started
&lt;/h3&gt;

&lt;p&gt;To integrate @ng-vibe/service-locator into your Angular application, simply install the package via npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @ng-vibe/service-locator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, configure it in your application module:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;provideNgVibeServiceLocator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@ng-vibe/service-locator&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;appConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ApplicationConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;providers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;...,&lt;/span&gt;
    &lt;span class="nf"&gt;provideNgVibeServiceLocator&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example Usage
&lt;/h3&gt;

&lt;p&gt;Here’s a quick look at how you might use @ng-vibe/service-locator to manage service instances effectively:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ServiceLocator&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@ng-vibe/service-locator&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;LoggerDummyService&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../services/logger-dummy.service&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CustomClass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loggerSingleton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ServiceLocator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LoggerDummyService&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loggerNewInstance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ServiceLocator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;LoggerDummyService&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Wrap-Up
&lt;/h3&gt;

&lt;p&gt;The @ng-vibe/service-locator library makes extending Angular's DI capabilities straightforward and intuitive, especially useful in large applications where maintaining clean architecture is crucial. It helps you manage dependencies without tightly coupling your classes to Angular's components or services structure. For more details and how to contribute, check out the &lt;a href="https://www.npmjs.com/package/@ng-vibe/service-locator"&gt;project on npm&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stay Connected
&lt;/h3&gt;

&lt;p&gt;For updates and more insights, follow me on &lt;a href="https://www.linkedin.com/in/boris-jenicek/"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Project Repository: &lt;a href="https://github.com/boris-jenicek/ng-vibe"&gt;https://github.com/boris-jenicek/ng-vibe&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>tutorial</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Unleash the Power of Angular 17+ with Ng-vibe Open-Source Libraries</title>
      <dc:creator>Boris Jenicek</dc:creator>
      <pubDate>Wed, 10 Apr 2024 16:04:46 +0000</pubDate>
      <link>https://forem.com/borisjenicek/unleash-the-power-of-angular-17-with-ng-vibe-open-source-libraries-4hde</link>
      <guid>https://forem.com/borisjenicek/unleash-the-power-of-angular-17-with-ng-vibe-open-source-libraries-4hde</guid>
      <description>&lt;h3&gt;
  
  
  Dive into my open-source Angular libraries for enhanced UI components and functionalities. Explore, contribute, and elevate your Angular projects with ease.
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Zagreb, Croatia - Calling all Angular enthusiasts and developers! Get ready to supercharge your Angular 17+ projects with a collection of open-source libraries I've created just for you.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hey there, it's Boris Jeniček here, greeting you from the picturesque city of Zagreb, Croatia. I'm deeply passionate about programming, especially when it comes to creating elegant, efficient, and reusable code. That's why I've embarked on this journey to develop a suite of Angular open-source libraries under the ng-vibe banner, specifically tailored for Angular 17 and beyond. These libraries are my gift to you—to not only enhance your Angular projects but also to invite you into a collaborative journey that promises to break new ground in the Angular world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why My Libraries? 🚀
&lt;/h2&gt;

&lt;p&gt;In today's digital landscape, where user experience is king, having access to dynamic, easy-to-use UI components is more important than ever. That's where my open-source libraries come in. Designed to integrate seamlessly with Angular 17+, they offer a rich set of functionalities that can help reduce development time, boost performance, and, most importantly, create engaging and dynamic user experiences.&lt;/p&gt;

&lt;p&gt;But that's not all. By embracing the open-source philosophy, these libraries are more than just tools; they're an invitation. An invitation to explore, to experiment, and to contribute. Whether you're a seasoned developer or just starting out, your insights, critiques, and contributions are what will propel these libraries forward.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spotlight on ng-vibe Libraries
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/@ng-vibe/drawer"&gt;@ng-vibe/drawer&lt;/a&gt;:&lt;/strong&gt; Say hello to dynamic drawer components that can be customized and controlled entirely through TypeScript. Say goodbye to static side panels and hello to interactive, animated drawers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/@ng-vibe/dialog"&gt;@ng-vibe/dialog&lt;/a&gt;:&lt;/strong&gt; Dialog management has never been easier. With extensive configuration options for dimensions, animations, overlays, and more, creating and managing modals and pop-ups is a breeze.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/@ng-vibe/toastify"&gt;@ng-vibe/toastify&lt;/a&gt;:&lt;/strong&gt; Take feedback within your Angular applications to the next level with fluid, customizable toast messages. Designed for dynamic feedback and alerts, toastify offers multiple positioning and extensive customization options.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.npmjs.com/package/@ng-vibe/timer"&gt;@ng-vibe/timer&lt;/a&gt;:&lt;/strong&gt; Time is of the essence. Arm your Angular applications with a comprehensive timer library, perfect for progress or remaining calculations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Join the Adventure - Contributing to ng-vibe ❤️
&lt;/h2&gt;

&lt;p&gt;The open-source community thrives on collaboration and contribution. Whether you have a suggestion to improve a library, want to report a bug, or have the urge to develop a new feature—your input is invaluable. Fork the &lt;a href="https://github.com/boris-jenicek/ng-vibe"&gt;ng-vibe repository&lt;/a&gt;, dive into the code, and let your creativity lead the way. Don't forget to star the project and share it with other developers!&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting Started with ng-vibe
&lt;/h3&gt;

&lt;p&gt;Getting involved with ng-vibe is easy. Simply clone the repository, install the necessary dependencies, and explore the capabilities of each package. Whether you're looking to integrate a library into your project or contribute to its development, everything you need is right at your fingertips.&lt;/p&gt;

&lt;h2&gt;
  
  
  A New Chapter
&lt;/h2&gt;

&lt;p&gt;As we embark on this open-source adventure together, I want to announce a significant change. My previous project, &lt;a href="https://www.npmjs.com/package/@costlydeveloper/ngx-awesome-popup"&gt;@costlydeveloper/ngx-awesome-popup&lt;/a&gt;, which has served us well, will now be passing the torch to ng-vibe. This transition marks a new chapter in our journey to provide the Angular community with tools that are not only powerful and flexible but also driven by the community.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Road Ahead
&lt;/h3&gt;

&lt;p&gt;The future of ng-vibe is bright, and it's paved with the contributions, feedback, and insights of developers like you. Let's make Angular development not just easier, but more enjoyable. Together, we can build something truly amazing.&lt;/p&gt;

&lt;p&gt;I'm thrilled to see where this journey takes us. Let's code, collaborate, and create, one commit at a time. 🚀&lt;/p&gt;




&lt;p&gt;Excited to see how these libraries can transform your projects? Or perhaps you're eager to contribute? Dive into the &lt;a href="https://github.com/boris-jenicek/ng-vibe"&gt;ng-vibe GitHub repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ibe) or explore the libraries on &lt;a href="https://www.npmjs.com/org/ng-vibe"&gt;npm&lt;/a&gt; to get started. Your feedback, contributions, and stars are what make the open-source community so vibrant and dynamic. Let's build something great together.&lt;/p&gt;

&lt;p&gt;Remember, every line of code counts, and every contribution makes a difference. Happy coding!&lt;/p&gt;

&lt;p&gt;Boris Jeniček - &lt;a href="https://www.linkedin.com/in/boris-jenicek/"&gt;LinkedIn&lt;/a&gt; | &lt;a href="https://github.com/boris-jenicek"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Software Developer, Open-Source Enthusiast, Angular Advocate&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;This blog post is just the beginning of what I hope to be a long and fruitful journey of collaboration and innovation within the Angular community. I can't wait to see where we go from here. Thanks for reading, and here's to the countless projects we'll elevate together with ng-vibe!&lt;/p&gt;

</description>
      <category>angular</category>
      <category>npm</category>
      <category>solidprinciples</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Ngx, Confirm box for Angular 🚀</title>
      <dc:creator>Boris Jenicek</dc:creator>
      <pubDate>Wed, 27 Oct 2021 16:06:03 +0000</pubDate>
      <link>https://forem.com/borisjenicek/ngx-confirm-box-for-angular-3cgi</link>
      <guid>https://forem.com/borisjenicek/ngx-confirm-box-for-angular-3cgi</guid>
      <description>&lt;p&gt;Today's topic is &lt;strong&gt;Confirmation dialog box in Angular&lt;/strong&gt;. It's been a while since my last post, and this one might be pretty useful for Angular developers. In the following several passages I'll try to answer several questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;What is the confirmation box in Angular? &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;What is the best confirmation dialog for Angular, and why? &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How to integrate it into any Angular project?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;How it looks like?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  What is the confirmation box in Angular?
&lt;/h1&gt;

&lt;p&gt;It is a simple popup that prevents unwanted actions, for example when the user clicks the delete button, the popup dialog should appear with the question: &lt;strong&gt;"Are you sure you want to delete &lt;em&gt;item data&lt;/em&gt;?"&lt;/strong&gt; and two buttons &lt;strong&gt;"Confirm"&lt;/strong&gt; and &lt;strong&gt;"Decline"&lt;/strong&gt;. That is an enhanced level of security needed in almost every professional application. &lt;/p&gt;




&lt;h1&gt;
  
  
  What is the best confirmation dialog for Angular?
&lt;/h1&gt;

&lt;p&gt;It is the &lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/confirm-box-generator" rel="noopener noreferrer"&gt;ngx-awesome-popup&lt;/a&gt; an open-source library made for Angular. It provides highly scalable options and styles to adapt to any angular project. The best part is it's callable only from typescript so it can be used directly in services without HTML templates and it uses observables. &lt;/p&gt;




&lt;h1&gt;
  
  
  How to integrate it into the project?
&lt;/h1&gt;

&lt;h5&gt;
  
  
  1. install it to your angular project:
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
npm i @costlydeveloper/ngx-awesome-popup

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  2. Import in App.module.ts
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="nx"&gt;imports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;

    &lt;span class="nx"&gt;NgxAwesomePopupModule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forRoot&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; 

    &lt;span class="nx"&gt;ConfirmBoxConfigModule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forRoot&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="p"&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  3. Setup confirm box function / method
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="nf"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;confirmBox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ConfirmBoxInitializer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setTitle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Are you sure?&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Confirm to delete user: John Doe!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setButtonLabels&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;YES&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;NO&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;



        &lt;span class="c1"&gt;// Choose layout color type&lt;/span&gt;

        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;

            &lt;span class="na"&gt;LayoutType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;DialogLayoutDisplay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DANGER&lt;/span&gt; &lt;span class="c1"&gt;// SUCCESS | INFO | NONE | DANGER | WARNING&lt;/span&gt;

        &lt;span class="p"&gt;});&lt;/span&gt;



        &lt;span class="c1"&gt;// Simply open the popup and listen which button is clicked&lt;/span&gt;

        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;openConfirmBox&lt;/span&gt;&lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

            &lt;span class="c1"&gt;// do some action after user click on a button&lt;/span&gt;

            &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Clicked button response: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  4. Or use code generator
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/confirm-box-generator" rel="noopener noreferrer"&gt;Confirm box code generator&lt;/a&gt; and specify your needs.&lt;/p&gt;




&lt;h1&gt;
  
  
  How does it look like?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fconfirm-box.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fconfirm-box.png" alt="Confirm box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fconfirm-box-red.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fconfirm-box-red.png" alt="Confirm box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdb2zyuu3kvn61uadfxva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdb2zyuu3kvn61uadfxva.png" alt="Confirm box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx70nimvoimxtv7ui7kpq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx70nimvoimxtv7ui7kpq.png" alt="Confirm box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Where to see more?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/confirm-box-generator" rel="noopener noreferrer"&gt;Confirm box - playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackblitz.com/edit/minimal-confirm-box?file=src/app/app.component.ts" rel="noopener noreferrer"&gt;Confirm box - StackBlitz&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/@costlydeveloper/ngx-awesome-popup" rel="noopener noreferrer"&gt;npm library&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/costlydeveloper/ngx-awesome-popup/discussions" rel="noopener noreferrer"&gt;The community, Q&amp;amp;A&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>tutorial</category>
      <category>opensource</category>
      <category>typescript</category>
    </item>
    <item>
      <title>ngx-awesome-popup Interactive modals on steroids 🚀</title>
      <dc:creator>Boris Jenicek</dc:creator>
      <pubDate>Mon, 24 May 2021 20:59:35 +0000</pubDate>
      <link>https://forem.com/borisjenicek/ngx-awesome-popup-interactive-modals-on-steroids-2ej3</link>
      <guid>https://forem.com/borisjenicek/ngx-awesome-popup-interactive-modals-on-steroids-2ej3</guid>
      <description>&lt;h1&gt;
  
  
  What is it?
&lt;/h1&gt;

&lt;p&gt;It's the npm library made for the Angular 9+&lt;/p&gt;

&lt;h1&gt;
  
  
  What it does?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;It provides:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Evoking dynamic components in popup&lt;/li&gt;
&lt;li&gt;Toast Notifications&lt;/li&gt;
&lt;li&gt;Alert Box&lt;/li&gt;
&lt;li&gt;Confirm Box&lt;/li&gt;
&lt;li&gt;Cookie GDPR banner&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Why it is better than others?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;It has:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean API&lt;/li&gt;
&lt;li&gt;Better documented than others&lt;/li&gt;
&lt;li&gt;Easy to use&lt;/li&gt;
&lt;li&gt;d.ts files&lt;/li&gt;
&lt;li&gt;Awesome snippet generator&lt;/li&gt;
&lt;li&gt;Ability of global or local configuration&lt;/li&gt;
&lt;li&gt;Predefined styles&lt;/li&gt;
&lt;li&gt;Easy to change colors &lt;/li&gt;
&lt;li&gt;Button generator&lt;/li&gt;
&lt;li&gt;Simple and powerful &lt;strong&gt;D&lt;/strong&gt;ependency &lt;strong&gt;I&lt;/strong&gt;njection &lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Show me the API!
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Okay&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;toastNotification&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;newToastNotification&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ToastNotificationInitializer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nx"&gt;newToastNotification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setTitle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Title!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;newToastNotification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Message!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;newToastNotification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
            &lt;span class="na"&gt;LayoutType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;DialogLayoutDisplay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;INFO&lt;/span&gt; &lt;span class="c1"&gt;// SUCCESS | INFO | NONE | DANGER | WARNING&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="nx"&gt;newToastNotification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;openToastNotification&lt;/span&gt;&lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;confirmBox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ConfirmBoxInitializer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setTitle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Title!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Message!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setButtonLabels&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Button1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Button2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
            &lt;span class="na"&gt;LayoutType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;DialogLayoutDisplay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SUCCESS&lt;/span&gt; &lt;span class="c1"&gt;// SUCCESS | INFO | NONE | DANGER | WARNING&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="nx"&gt;confirmBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;openConfirmBox&lt;/span&gt;&lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// button response&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;dialog&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dialogPopup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DialogInitializer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AnyAngularComponent&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;dialogPopup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setCustomData&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;myData&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt; 
        &lt;span class="nx"&gt;dialogPopup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
            &lt;span class="na"&gt;Width&lt;/span&gt;     &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;500px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="nx"&gt;dialogPopup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setButtons&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
            &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ButtonMaker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Submit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;submit&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ButtonLayoutDisplay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SUCCESS&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ButtonMaker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cancel&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cancel&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ButtonLayoutDisplay&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;SECONDARY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;]);&lt;/span&gt;

        &lt;span class="nx"&gt;dialogPopup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;openDialog&lt;/span&gt;&lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// button response&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  How does it look like?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Here's how!&lt;/strong&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Toast Notifications
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Ftoasts.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Ftoasts.gif" alt="Toast"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Confirm box
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fconfirm-box-red.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fconfirm-box-red.png" alt="Confirm box"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Cookie banner
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fcookies-banner.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcostlydeveloper.github.io%2Fngx-awesome-popup%2Fassets%2Fcookies-banner.png" alt="Cookie banner"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Where to see more?
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/toast-generator" rel="noopener noreferrer"&gt;Toast - playground&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackblitz.com/edit/minimal-toast-notification?file=src/app/app.component.ts" rel="noopener noreferrer"&gt;Toast - StackBlitz&lt;/a&gt;&lt;br&gt;
&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/confirm-box-generator" rel="noopener noreferrer"&gt;Confirm box - playground&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackblitz.com/edit/minimal-confirm-box?file=src/app/app.component.ts" rel="noopener noreferrer"&gt;Confirm box - StackBlitz&lt;/a&gt;&lt;br&gt;
&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/dialog-showcase" rel="noopener noreferrer"&gt;Dialog - playground&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>npm</category>
      <category>typescript</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Why did I make the npm library?</title>
      <dc:creator>Boris Jenicek</dc:creator>
      <pubDate>Sat, 22 May 2021 20:25:13 +0000</pubDate>
      <link>https://forem.com/borisjenicek/user-interactive-modals-on-steroids-31oe</link>
      <guid>https://forem.com/borisjenicek/user-interactive-modals-on-steroids-31oe</guid>
      <description>&lt;p&gt;First of all, many thanks for showing the interest in this article. 👀&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In the next few passages, I will try to explain why in many Angular projects it is important to have good modal and notification features as well as why I wrote the npm library on that subject.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the professional world, I have several years as an Angular developer behind me and a few more of developing in other technologies.&lt;/p&gt;




&lt;h2&gt;
  
  
  Web development abstract
&lt;/h2&gt;

&lt;p&gt;Angular is for sure one of the worthy things that improved web development in the last ten years. The way it handles the view of the HTML and how it binds it with typescript is great. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The small minus&lt;/strong&gt; is, like in almost any other framework which imposes their own structures, that the developers can be brought into the situation to just follow the basic imposed way of creating things. Often a framework dominates with architecture and the intended paths that should be followed. That does not mean that we should not think out of the box.&lt;/p&gt;

&lt;h2&gt;
  
  
  How is Angular doing it, out-of-the-box
&lt;/h2&gt;

&lt;p&gt;As we know, Angular is providing an easy way to call another component from HTML with the tag selector to be rendered into the DOM. It also provides a way to call another component and render its view to the DOM, but only from typescript, which is called dynamic component creation and it's a bit more complicated way, but that does not mean it is not a good way, it's just harder. &lt;br&gt;
&lt;strong&gt;That is where out-of-the-box thinking comes to the foreground&lt;/strong&gt;, of course, it is not bad to use HTML component selectors but there are some use cases where it is better to use dynamic component creation. Under the hood, the Angular itself uses that same way, and we can choose how and from where we will evoke the component in the way the angular engine does it.&lt;/p&gt;




&lt;h2&gt;
  
  
  What can we do?
&lt;/h2&gt;

&lt;p&gt;Here comes the modal story; what if we create a modal from the typescript method, what if the object itself can evoke the modal with a form to edit itself? That is a really nice use case now, and how is that good? For example, if we have a list of items and every item object has an update method, it can evoke the edit form component in the modal from any part of the application, and there is no need for an HTML selector. Wherever the "item object" is, and while it has an update method, it can evoke its own form and bring the popup to a predefined place on the screen. &lt;/p&gt;

&lt;p&gt;There are more use cases. A similar thing is with notifications and confirm boxes. The app business logic is not always in angular components, we often make custom classes, services, or in redux architecture, for example, ngrx-effects. Take a look at an example in a service that has an HTTP server request, in case it returns an error it would be nice to evoke some kind of error message directly from there, and not coupling the logic with the component, the view. &lt;/p&gt;

&lt;p&gt;Or another example when we want to delete an item, we need some kind of security system as a confirmation box and all we want to know what button is clicked by the user. Is it confirmed or declined so we know wether to delete the item. In the same way, confirm box can be called from any typescript method, and in that way it is more decoupled, it relies on the SOLID principles.&lt;/p&gt;




&lt;h2&gt;
  
  
  How it started?
&lt;/h2&gt;

&lt;p&gt;In one period of my Angular work, I was requested to find the solution for one specific design pattern. It needed to keep the object reference while the object can be edited from any part of the application, to be modular and callable from typescript. I had read, spent many nights exploring how Angular material is handling the dynamic components, and after a while I got some knowledge about that topic and delivered the idea.&lt;/p&gt;

&lt;p&gt;Time passed and I continued to research the topic from time to time and I decided to write a fully extendable library from scratch which rests on my knowledge of dynamic component creation in Angular.&lt;/p&gt;

&lt;p&gt;I decided I want to make it modular and make three modules: Toast notification module, Confirm box module, and Dialog module. Every one of them will have its own logic but common inheritance; It will be highly scalable and easy to change without breaking the public API, and easy to extend with a new functionality; The uncompiled code will be publicly available, intuitive, open to contribution and understanding; It will have high-quality documentation and code examples to make it easy for other developers who will use it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The library
&lt;/h2&gt;

&lt;p&gt;With good motivation, and little more than a few nights, the code became the usable product, and code comments became the documentation.&lt;/p&gt;

&lt;p&gt;I am happy to announce the library ngx-awesome-popup and invite every positive mood developer to contribute with any constructive suggestion, improvement, or bug finding.&lt;/p&gt;

&lt;p&gt;Modules are separated as planned, it is a highly customisable and extensible solution, SOLID principles are respected in solid amount, it could even be more optimised in future. It implements a predefined user interfaces with many options for customisations, as well as public API exports such as enums, interfaces, d.ts files to help and make usage nice and easy.&lt;/p&gt;

&lt;p&gt;The package is created with "ng-packagr" and API documentation is generated with "TypeDoc", the GitHub repo could be found &lt;a href="https://github.com/costlydeveloper/ngx-awesome-popup"&gt;here&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;If you have endured up to there, WOW 😁 thank you for reading, and welcome to playground or StackBlitz.&lt;/p&gt;

&lt;h5&gt;
  
  
  Toast Notifications
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VtqAxxyj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://costlydeveloper.github.io/ngx-awesome-popup/assets/toasts.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VtqAxxyj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://costlydeveloper.github.io/ngx-awesome-popup/assets/toasts.gif" alt="Toast" width="414" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Confirm box
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--egFh8Obz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://costlydeveloper.github.io/ngx-awesome-popup/assets/confirm-box-red.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--egFh8Obz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://costlydeveloper.github.io/ngx-awesome-popup/assets/confirm-box-red.png" alt="Confirm box" width="465" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Cookie banner
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--il-gAldO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://costlydeveloper.github.io/ngx-awesome-popup/assets/cookies-banner.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--il-gAldO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://costlydeveloper.github.io/ngx-awesome-popup/assets/cookies-banner.png" alt="Cookie banner" width="372" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/toast-generator"&gt;Toast - playground&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackblitz.com/edit/minimal-toast-notification?file=src/app/app.component.ts"&gt;Toast - StackBlitz&lt;/a&gt;&lt;br&gt;
&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/confirm-box-generator"&gt;Confirm box - playground&lt;/a&gt;&lt;br&gt;
&lt;a href="https://stackblitz.com/edit/minimal-confirm-box?file=src/app/app.component.ts"&gt;Confirm box - StackBlitz&lt;/a&gt;&lt;br&gt;
&lt;a href="https://costlydeveloper.github.io/ngx-awesome-popup/#/playground/dialog-showcase"&gt;Dialog - playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/costlydeveloper/ngx-awesome-popup-interactive-modals-on-steroids-2ej3"&gt;&lt;strong&gt;Related article&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>npm</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
