<?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 Isuru Priyaranjana on Medium]]></title>
        <description><![CDATA[Stories by Isuru Priyaranjana on Medium]]></description>
        <link>https://medium.com/@isuruiup?source=rss-51aad4f6124c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*4z42DogrNIU11TccUgbKUQ.jpeg</url>
            <title>Stories by Isuru Priyaranjana on Medium</title>
            <link>https://medium.com/@isuruiup?source=rss-51aad4f6124c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 00:21:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isuruiup/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[Angular Without Zone.js: How Change Detection Works in a Zoneless World]]></title>
            <link>https://isuruiup.medium.com/angular-without-zone-js-how-change-detection-works-in-a-zoneless-world-20b3e01f6122?source=rss-51aad4f6124c------2</link>
            <guid isPermaLink="false">https://medium.com/p/20b3e01f6122</guid>
            <category><![CDATA[angular-zoneless]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Isuru Priyaranjana]]></dc:creator>
            <pubDate>Fri, 14 Aug 2026 18:23:12 GMT</pubDate>
            <atom:updated>2026-08-14T18:23:12.862Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dzlne9NHNzouoa1z9RcVgA.jpeg" /></figure><p>For years, one of Angular’s most convenient features has also been one of its least understood:</p><p><strong>You change some data, and somehow the UI updates.</strong></p><p>Maybe an HTTP request finishes. Maybe a setTimeout() callback executes. Maybe the user clicks a button. Most Angular developers rarely have to think about <em>how Angular knows</em> that something happened and that the component tree may need to be checked.</p><p>Historically, a major part of that answer has been <strong>Zone.js</strong> and Angular’s NgZone.</p><p>But Angular is moving away from that model.</p><p>Zoneless change detection became stable in Angular 20.2, and from Angular 21 onward zoneless is the default configuration. The current Angular 22 documentation explicitly describes Angular as operating without ZoneJS by default.</p><p>So an interesting question emerges:</p><blockquote><em>If Zone.js is removed, how does Angular know when it should run change detection?</em></blockquote><p>To understand the answer, we first need to understand what Zone.js and NgZone were actually doing.</p><h3>First: Zone.js and NgZone Are Not the Same Thing</h3><p>These two terms are often used interchangeably, but they represent different things.</p><p><strong>Zone.js</strong> is a library that patches asynchronous browser APIs.</p><p>For example:</p><pre>setTimeout(...)<br>Promise.then(...)<br>addEventListener(...)<br>XMLHttpRequest(...)</pre><p>By patching these APIs, Zone.js can keep track of asynchronous work happening in the application.</p><p>Angular then integrates with Zone.js through <strong>NgZone</strong>.</p><p>NgZone is an Angular service representing Angular&#39;s execution zone. Among other things, it exposes events such as:</p><pre>ngZone.onUnstable<br>ngZone.onMicrotaskEmpty<br>ngZone.onStable</pre><p>Angular historically uses these signals to determine when asynchronous activity has completed and when change detection may need to run.</p><p>Angular’s documentation describes onMicrotaskEmpty as a hint that Angular can perform change detection.</p><p>A simplified mental model looks like this:</p><pre>Browser async operation<br>        ↓<br>Zone.js detects it<br>        ↓<br>NgZone observes execution<br>        ↓<br>Async work settles<br>        ↓<br>Angular schedules change detection<br>        ↓<br>Component tree is checked<br>        ↓<br>DOM is updated</pre><p>This architecture gave Angular something extremely useful:</p><p><strong>automatic awareness of asynchronous activity.</strong></p><h3>Why Angular Needed Zone.js in the First Place</h3><p>Consider a simple component:</p><pre>export class AppComponent {<br>  message = &#39;Loading...&#39;;</pre><pre>  ngOnInit() {<br>    setTimeout(() =&gt; {<br>      this.message = &#39;Loaded!&#39;;<br>    }, 1000);<br>  }<br>}</pre><p>And the template:</p><pre>&lt;h1&gt;{{ message }}&lt;/h1&gt;</pre><p>Something interesting happens here.</p><p>JavaScript itself does not tell Angular:</p><blockquote><em>“Hey Angular, </em><em>message changed. You should update the DOM.&quot;</em></blockquote><p>The assignment:</p><pre>this.message = &#39;Loaded!&#39;;</pre><p>is simply JavaScript.</p><p>Angular needs some reason to run change detection again.</p><p>With Zone.js, the framework doesn’t necessarily need to understand what changed. It notices that an asynchronous task completed.</p><p>Conceptually:</p><pre>setTimeout finished<br>        ↓<br>Something MAY have changed<br>        ↓<br>Run Angular synchronization/change detection</pre><p>That last distinction is extremely important.</p><p>Zone.js generally tells Angular:</p><blockquote><strong><em>Something happened.</em></strong></blockquote><p>It does not tell Angular:</p><blockquote><strong><em>AppComponent.message changed.</em></strong></blockquote><p>That difference is one of the motivations behind zoneless Angular.</p><h3>The Cost of “Something Might Have Changed”</h3><p>Imagine an application containing a charting library.</p><p>The library registers frequent timers or browser events:</p><pre>mousemove<br>mousemove<br>mousemove<br>requestAnimationFrame<br>timer<br>timer<br>mousemove</pre><p>Many of those operations may have absolutely nothing to do with Angular state.</p><p>Yet Zone.js can observe asynchronous activity and cause Angular synchronization to be scheduled.</p><p>Angular’s own documentation calls this out: Zone.js uses DOM events and asynchronous tasks as indicators that application state <strong>might</strong> have changed, even though Zone.js does not actually know whether application state changed.</p><p>This can result in unnecessary work.</p><p>Historically, Angular developers sometimes worked around this with:</p><pre>this.ngZone.runOutsideAngular(() =&gt; {<br>  // expensive or high-frequency async work<br>});</pre><p>For example:</p><pre>constructor(private ngZone: NgZone) {}</pre><pre>startAnimation() {<br>  this.ngZone.runOutsideAngular(() =&gt; {<br>    requestAnimationFrame(() =&gt; {<br>      // animation work<br>    });<br>  });<br>}</pre><p>Running the operation outside Angular’s zone prevented every event from becoming a reason to run Angular change detection.</p><p>If Angular state eventually needed to change, developers could re-enter:</p><pre>this.ngZone.run(() =&gt; {<br>  this.status = &#39;finished&#39;;<br>});</pre><p>NgZone.runOutsideAngular() therefore became an important performance optimization in certain Angular applications.</p><h3>Then Signals Changed the Situation</h3><p>Signals introduced a fundamentally different capability.</p><p>Consider:</p><pre>count = signal(0);</pre><p>with:</p><pre>&lt;p&gt;{{ count() }}&lt;/p&gt;</pre><p>When Angular renders this template, Angular knows something very specific:</p><pre>This view depends on the `count` signal.</pre><p>Now update it:</p><pre>this.count.set(1);</pre><p>Angular doesn’t need a generic notification saying:</p><pre>&quot;A JavaScript asynchronous task happened somewhere.&quot;</pre><p>The signal itself can notify Angular:</p><pre>&quot;The state consumed by this view changed.&quot;</pre><p>That gives Angular much more precise information.</p><p>Conceptually:</p><pre>Zone-based</pre><pre>Async task happened<br>       ↓<br>Maybe something changed<br>       ↓<br>Check application</pre><p>versus:</p><pre>Signal-based notification</pre><pre>Relevant state changed<br>       ↓<br>Angular knows a view needs synchronization<br>       ↓<br>Schedule change detection</pre><p>This notification-driven model is one of the foundations that makes zoneless Angular practical.</p><h3>So What Replaces Zone.js?</h3><p>This is probably the most important part of the entire discussion.</p><p>Angular did <strong>not remove change detection</strong>.</p><p>It removed Zone.js as the mechanism responsible for telling Angular when change detection should be scheduled.</p><p>Angular still has:</p><pre>Templates<br>Bindings<br>Component views<br>Change detectors<br>Change-detection traversal<br>DOM updates</pre><p>What changes is the <strong>notification mechanism</strong>.</p><p>In a zoneless application, Angular relies on Angular APIs that explicitly tell the framework that a view may need updating.</p><p>According to Angular’s current documentation, these notifications include:</p><pre>ChangeDetectorRef.markForCheck()</pre><pre>ComponentRef.setInput()</pre><pre>Updating a signal that is read by a template</pre><pre>Template event listeners</pre><pre>Host listeners</pre><pre>Attaching a view that has already been marked dirty</pre><p>This is the core mental model for zoneless Angular.</p><h3>Example 1: Signals</h3><p>Consider:</p><pre>@Component({<br>  selector: &#39;app-counter&#39;,<br>  template: `<br>    &lt;button (click)=&quot;increment()&quot;&gt;+&lt;/button&gt;</pre><pre>    &lt;p&gt;{{ count() }}&lt;/p&gt;<br>  `<br>})<br>export class CounterComponent {</pre><pre>  count = signal(0);</pre><pre>  increment() {<br>    this.count.update(value =&gt; value + 1);<br>  }<br>}</pre><p>When:</p><pre>this.count.update(...)</pre><p>runs, Angular knows that a signal consumed by the template changed.</p><p>That notification causes Angular to schedule the necessary synchronization.</p><p>There is no requirement for Zone.js to intercept the click or patch asynchronous browser APIs just to discover that state may have changed.</p><p>Angular already knows <strong>what changed and why the view matters</strong>.</p><h3>Example 2: AsyncPipe</h3><p>Signals aren’t the only solution.</p><p>This still works perfectly well:</p><pre>users$ = this.userService.getUsers();</pre><p>with:</p><pre>@for (user of users$ | async; track user.id) {<br>  &lt;p&gt;{{ user.name }}&lt;/p&gt;<br>}</pre><p>Why?</p><p>Because AsyncPipe internally notifies Angular when a new value arrives.</p><p>Specifically, it calls the equivalent change-detection notification through markForCheck().</p><p>Angular explicitly lists ChangeDetectorRef.markForCheck()—including its use by AsyncPipe—as one of the notifications used by zoneless change detection.</p><p>So RxJS is not going anywhere because Angular becomes zoneless.</p><p>You can think of it as:</p><pre>Observable emits<br>       ↓<br>AsyncPipe receives value<br>       ↓<br>markForCheck()<br>       ↓<br>Angular schedules synchronization<br>       ↓<br>Template updates</pre><h3>Example 3: A Plain Property Is Where Things Become Interesting</h3><p>Suppose we write:</p><pre>export class UserComponent {</pre><pre>  name = &#39;John&#39;;</pre><pre>  loadUser() {<br>    fetch(&#39;/api/user&#39;)<br>      .then(response =&gt; response.json())<br>      .then(user =&gt; {<br>        this.name = user.name;<br>      });<br>  }<br>}</pre><p>and:</p><pre>&lt;p&gt;{{ name }}&lt;/p&gt;</pre><p>The assignment:</p><pre>this.name = user.name;</pre><p>does not itself provide Angular with a notification.</p><p>With Zone.js, completion of the Promise chain could provide the global signal that asynchronous activity occurred.</p><p>In a zoneless architecture, relying on that implicit relationship is exactly what we want to avoid.</p><p>A more zoneless-friendly design would be:</p><pre>name = signal(&#39;John&#39;);</pre><pre>loadUser() {<br>  fetch(&#39;/api/user&#39;)<br>    .then(response =&gt; response.json())<br>    .then(user =&gt; {<br>      this.name.set(user.name);<br>    });<br>}</pre><p>Now Angular receives an explicit notification through the signal.</p><p>Alternatively, when working with non-signal state:</p><pre>private cdr = inject(ChangeDetectorRef);</pre><pre>loadUser() {<br>  fetch(&#39;/api/user&#39;)<br>    .then(response =&gt; response.json())<br>    .then(user =&gt; {<br>      this.name = user.name;<br>      this.cdr.markForCheck();<br>    });<br>}</pre><p>Now Angular again knows that synchronization is required.</p><p>This illustrates an important principle:</p><blockquote><em>Zoneless Angular encourages state changes to happen through mechanisms Angular understands.</em></blockquote><h3>Does Zoneless Mean We Must Call detectChanges() Everywhere?</h3><p>No.</p><p>This is probably one of the biggest misconceptions around zoneless Angular.</p><p>The future is <strong>not</strong>:</p><pre>this.value = something;<br>this.cdr.detectChanges();</pre><pre>this.otherValue = somethingElse;<br>this.cdr.detectChanges();</pre><p>That would be painful and would defeat much of Angular’s declarative programming model.</p><p>The intended direction is primarily:</p><pre>Signals<br>AsyncPipe<br>Angular inputs<br>Template/host events<br>markForCheck when necessary<br>Framework APIs that notify Angular</pre><p>In other words:</p><p><strong>notification-driven change detection</strong>, not manually forcing rendering everywhere.</p><h3>What About OnPush?</h3><p>This is another interesting part of the transition.</p><p>OnPush has historically been a major Angular performance strategy:</p><pre>@Component({<br>  changeDetection: ChangeDetectionStrategy.OnPush<br>})</pre><p>But its role also makes it a useful stepping stone toward zoneless applications.</p><p>Angular currently recommends making application components OnPush compatible when preparing for zoneless operation, although OnPush itself is <strong>not required</strong> for zoneless Angular.</p><p>Why?</p><p>Because OnPush already encourages developers to work with explicit state-change boundaries:</p><pre>Input changes<br>Events<br>AsyncPipe<br>Signals<br>markForCheck()</pre><p>Those patterns align naturally with the notification model used by zoneless Angular.</p><p>You could therefore think of modern Angular development as progressively moving from:</p><pre>Mutable state<br>+<br>Default change detection<br>+<br>Zone.js detects async activity</pre><p>toward:</p><pre>Reactive state<br>+<br>Signals / RxJS<br>+<br>Explicit Angular notifications<br>+<br>Targeted synchronization</pre><h3>What Happens to NgZone?</h3><p>This part is subtle.</p><p>Zoneless does <strong>not</strong> mean that every reference to NgZone instantly becomes invalid.</p><p>Angular specifically states that:</p><pre>NgZone.run()<br>NgZone.runOutsideAngular()</pre><p>remain compatible with zoneless applications.</p><p>This matters particularly for libraries that need to support both zone-based and zoneless Angular applications.</p><p>However, APIs based on Zone.js stability become problematic.</p><p>For example:</p><pre>ngZone.onStable<br>ngZone.onUnstable<br>ngZone.onMicrotaskEmpty<br>ngZone.isStable</pre><p>should not be used as application synchronization mechanisms in zoneless applications.</p><p>Angular’s documentation states that these NgZone observables do not emit when zoneless change detection is enabled, while NgZone.isStable remains true.</p><p>If code previously did something like:</p><pre>this.ngZone.onStable<br>  .pipe(take(1))<br>  .subscribe(() =&gt; {<br>    // interact with rendered DOM<br>  });</pre><p>modern Angular provides render lifecycle APIs such as:</p><pre>afterNextRender(...)</pre><p>and:</p><pre>afterEveryRender(...)</pre><p>which express the intention much more directly.</p><h3>Zoneless Doesn’t Mean Angular Checks Only One Binding</h3><p>There is another misconception worth clearing up.</p><p>Signals give Angular precise information about <strong>when synchronization is necessary</strong> and which views have become dirty.</p><p>That does not necessarily mean:</p><pre>signal changed<br>→ Angular updates exactly one DOM text node<br>→ nothing else executes</pre><p>Angular still has its view tree and change-detection machinery.</p><p>The improvement is that Angular can make much better decisions about <strong>whether synchronization needs to happen and which parts of the component tree participate</strong>.</p><p>So zoneless Angular should not be confused with completely abandoning Angular change detection.</p><p>It is better understood as changing the <strong>scheduler and notification model</strong> behind change detection.</p><h3>A Better Mental Model</h3><p>The old mental model was roughly:</p><pre>Zone.js<br>                   ↓<br>     ┌──────────────────────────┐<br>     │ Something async happened│<br>     └──────────────────────────┘<br>                   ↓<br>             Angular notified<br>                   ↓<br>           Change detection<br>                   ↓<br>              DOM update</pre><p>The zoneless model is closer to:</p><pre>Application state<br>                    ↓<br>       ┌─────────────────────────┐<br>       │ Angular-aware mutation  │<br>       │                         │<br>       │ signal.set()            │<br>       │ AsyncPipe emission      │<br>       │ markForCheck()          │<br>       │ Component input         │<br>       │ template event          │<br>       └─────────────────────────┘<br>                    ↓<br>          Angular is notified<br>                    ↓<br>      Relevant views marked dirty<br>                    ↓<br>       Synchronization scheduled<br>                    ↓<br>            Change detection<br>                    ↓<br>               DOM update</pre><p>The difference is subtle but fundamental.</p><p>Zone-based Angular asks:</p><blockquote><strong><em>Did something happen that might have changed the application?</em></strong></blockquote><p>Zoneless Angular increasingly asks:</p><blockquote><strong><em>Did Angular receive a notification that application state relevant to the view changed?</em></strong></blockquote><h3>Why This Direction Makes Sense</h3><p>Removing Zone.js gives Angular several advantages.</p><p>The Angular team highlights reduced unnecessary synchronization, smaller application overhead, better debugging, and better compatibility with browser APIs and third-party libraries because Zone.js no longer needs to monkey-patch asynchronous APIs.</p><p>But there is an architectural benefit that I find even more interesting.</p><p>Angular applications become <strong>more explicit about their reactive boundaries</strong>.</p><p>Instead of:</p><pre>Something asynchronous happened somewhere.<br>Let&#39;s inspect the application.</pre><p>we move toward:</p><pre>This application state changed.<br>These views depend on it.<br>Angular should synchronize them.</pre><p>That is a much cleaner mental model for a reactive framework.</p><h3>The Bigger Angular Evolution</h3><p>When viewed independently, features such as:</p><pre>Signals<br>computed()<br>effect()<br>Signal inputs<br>OnPush<br>Zoneless change detection</pre><p>can look like separate Angular improvements.</p><p>They make much more sense when viewed as part of the same architectural direction.</p><p>Angular is gradually shifting from an architecture heavily dependent on <strong>global asynchronous observation</strong> toward one built around <strong>explicit reactive dependencies and framework notifications</strong>.</p><p>Zone.js solved an extremely difficult problem elegantly for many years.</p><p>It allowed Angular developers to write:</p><pre>this.value = newValue;</pre><p>and have the framework reliably discover that something may have changed after asynchronous operations.</p><p>But modern Angular increasingly has something better:</p><p><strong>knowledge of the actual state relationships inside the application.</strong></p><p>And once Angular knows when relevant state changes, it no longer needs to watch every asynchronous operation just in case.</p><p>That, more than simply removing a dependency, is what makes zoneless Angular interesting.</p><h3>Final Takeaway</h3><p>If you remember only one thing about zoneless Angular, make it this:</p><blockquote><strong><em>Angular is not removing change detection. Angular is replacing Zone.js as the mechanism that tells change detection when it needs to run.</em></strong></blockquote><p>With Zone.js:</p><pre>Async activity<br>→ maybe state changed<br>→ notify Angular</pre><p>With zoneless Angular:</p><pre>Angular-aware state change<br>→ Angular knows something changed<br>→ schedule synchronization</pre><p>Signals make that model particularly powerful because the framework can understand reactive dependencies directly.</p><p>So the move to zoneless isn’t just a performance optimization.</p><p>It represents a deeper change in how Angular understands application state:</p><p><strong>from observing the environment to being notified by the state itself.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20b3e01f6122" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publishing Public Calendars to Be Subscribed in Google and Outlook Calendars]]></title>
            <link>https://isuruiup.medium.com/publishing-public-calendars-to-be-subscribed-in-google-and-outlook-calendars-3e2f508a7260?source=rss-51aad4f6124c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e2f508a7260</guid>
            <category><![CDATA[outlook-calendar]]></category>
            <category><![CDATA[business-information]]></category>
            <category><![CDATA[google-calendar]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Isuru Priyaranjana]]></dc:creator>
            <pubDate>Sat, 08 Mar 2025 17:06:30 GMT</pubDate>
            <atom:updated>2025-03-08T17:09:14.202Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxfnf5Vw3MrySZ6nBj2L1Q.png" /></figure><p>Keeping customers informed about upcoming bookings or events is crucial for businesses. One effective way to do this is by providing a public calendar feed that users can subscribe to in Google Calendar and Outlook Calendar. This article explores how to generate an iCalendar (.ics) file dynamically via an API and the limitations of feed URL synchronization across different platforms.</p><h3>Generating a Dynamic .ICS File via API</h3><p>To allow users to subscribe to a dynamically updating calendar, an API endpoint can be created that returns an .ics file. This file contains calendar event details formatted according to the iCalendar standard.</p><p>For example, here’s how an API can return a .ics file using NestJS with two hardcoded bookings. In a real implementation, a mapping function should generate the payload dynamically from database records.</p><pre>import { Controller, Get, Res } from &#39;@nestjs/common&#39;;<br>import { Response } from &#39;express&#39;;<br><br><br>@Controller(&#39;calendar&#39;)<br>export class CalendarController {<br>  @Get(&#39;feed.ics&#39;)<br>  getCalendar(@Res() res: Response) {<br>    const now = new Date();<br>    const tomorrow = new Date(now);<br>    tomorrow.setDate(tomorrow.getDate() + 1);<br>    const formatDate = (date: Date) =&gt; date.toISOString().replace(/[-:]/g, &#39;&#39;).split(&#39;.&#39;)[0] + &#39;Z&#39;;<br>    const icsData = `BEGIN:VCALENDAR<br>VERSION:2.0<br>PRODID:-//RepairShopCalendar//EN<br>CALSCALE:GREGORIAN<br>METHOD:PUBLISH<br>BEGIN:VEVENT<br>UID:booking2@repairshop.com<br>DTSTAMP:${formatDate(now)}<br>DTSTART:${formatDate(now)}<br>DTEND:${formatDate(tomorrow)}<br>SUMMARY:Vehicle Repair - Toyota YARIS<br>DESCRIPTION:Repair service for Toyota Camry\nCustomer: John Doe\nService: Oil Change<br>LOCATION:Main Shop Floor<br>STATUS:CONFIRMED<br>END:VEVENT<br>BEGIN:VEVENT<br>UID:booking3@repairshop.com<br>DTSTAMP:${formatDate(now)}<br>DTSTART:${formatDate(tomorrow)}<br>DTEND:${formatDate(new Date(tomorrow.getTime() + 24 * 60 * 60 * 1000))}<br>SUMMARY:Vehicle Repair - Honda CLUB<br>DESCRIPTION:Repair service for Honda Civic\nCustomer: Jane Smith\nService: Brake Inspection<br>LOCATION:Service Bay 2<br>STATUS:CONFIRMED<br>END:VEVENT<br>END:VCALENDAR`.trim();<br>    res.setHeader(&#39;Content-Type&#39;, &#39;text/calendar&#39;);<br>    res.setHeader(&#39;Content-Disposition&#39;, &#39;attachment; filename=&quot;calendar.ics&quot;&#39;);<br>    res.send(icsData);<br>  }<br>}</pre><h3>Subscribing to the Calendar Feed in Google Calendar</h3><p>Once the API is set up to serve the .ics file, users can subscribe to it in Google Calendar by following these steps:</p><p><strong>Step 1:</strong> Open Google Calendar and click on the + icon next to “Other calendars”.</p><p><strong>Step 2:</strong> Select From URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/866/1*86idvP2JddxTpOpXe39rYw.png" /></figure><p><strong>Step 3:</strong> Enter the calendar feed URL (e.g., <a href="https://yourdomain.com/calendar/feed.ics).">https://yourdomain.com/calendar/feed.ics).</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*X7Hfa8_RdLlPz2ADyV15yg.png" /></figure><p><strong>Step 4:</strong> Click Add Calendar. Google Calendar will now subscribe to the feed and display the events.</p><h3>Limitations of Google Calendar Sync</h3><p>Google Calendar does not refresh subscribed .ics feeds in real time. Updates can take <strong>12-24+ hours</strong> to reflect. There is no official documentation specifying the exact refresh frequency.</p><h3>Subscribing to the Calendar Feed in Outlook Calendar</h3><p>Similar to Google Calendar, users can subscribe to an .ics feed in Outlook Calendar:</p><p><strong>Step 1:</strong> Open Outlook Calendar and click on Add Calendar &gt; Subscribe from web.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HH-5VEPoCumzap_vYRIL9A.png" /></figure><p><strong>Step 2:</strong> Enter the calendar feed URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*scluQUbEOgE9CAhXRZ1usA.png" /></figure><p><strong>Step 3:</strong> Click Import. Outlook will fetch the events from the provided feed.</p><h3>Limitations of Outlook Calendar Sync</h3><p>Outlook Calendar also does not sync in real time. The refresh frequency varies between <strong>3–24+ hours</strong>, making it inconsistent.</p><h3>Using Webcal Format</h3><p>Since Microsoft Outlook suggests using the webcal:// format for calendar subscriptions, the following format is used:</p><pre>webcal://yourdomain.com/calendar/feed.ics</pre><p>Additionally, direct Add to Calendar links can be used:</p><ul><li><strong>Google Calendar:</strong><br> <a href="https://calendar.google.com/calendar/r?cid=webcal://yourdomain.com/calendar/feed.ics">https://calendar.google.com/calendar/r?cid=webcal://yourdomain.com/calendar/feed.ics</a></li><li><strong>Outlook Calendar:</strong><br> <a href="https://outlook.office.com/calendar/0/addfromweb?url=webcal://yourdomain.com/calendar/feed.ics">https://outlook.office.com/calendar/0/addfromweb?url=webcal://yourdomain.com/calendar/feed.ics</a></li></ul><h3>Conclusion</h3><p>Calendar App Polling Frequency <strong>Google Calendar</strong> 12–24+ hours (sometimes longer) <strong>Outlook Calendar</strong> 3–24+ hours (inconsistent)</p><p>While .ics feed URLs provide a simple way to share calendar events, they do not guarantee real-time updates. Businesses needing instant updates should integrate directly with a calendar API.</p><p>Let me know in the comments if you’ve found any better ways to improve sync times in Google and Outlook Public Calendar feeds !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e2f508a7260" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Micro frontends in Angular with Native Federation: Resolving Common Issues]]></title>
            <link>https://isuruiup.medium.com/micro-frontends-in-angular-with-native-federation-resolving-common-issues-282fe7bc0418?source=rss-51aad4f6124c------2</link>
            <guid isPermaLink="false">https://medium.com/p/282fe7bc0418</guid>
            <category><![CDATA[angular-architecture]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[native-federation]]></category>
            <category><![CDATA[micro-frontends]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Isuru Priyaranjana]]></dc:creator>
            <pubDate>Sun, 26 Jan 2025 10:12:48 GMT</pubDate>
            <atom:updated>2025-01-26T10:12:48.409Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zWntEUUdPMHM3gwaHw3uTg.png" /></figure><p>Micro frontend architecture provides a powerful solution when we have control over both the main app and its associated micro applications. It allows us to build applications as separate, smaller modules that work cohesively. Each module can be developed by different teams and deployed independently. The discrete pieces, or “remotes,” are combined into a cohesive “host application” (also called a “shell application”).</p><p>In this article, we’ll explore how to implement micro frontends in Angular using <strong>Native Federation</strong> and tackle common issues faced during configuration.</p><h3>Understanding Host, Remote, and Dynamic-Host</h3><p>Before diving into implementation, let’s clarify the key types of applications in micro frontends:</p><p>• <strong>Host Application</strong>:<br> The main application that serves as a container for remotes. It defines the routes or components where remote modules will be loaded dynamically.</p><p>• <strong>Remote Application</strong>:<br> These are the smaller, independent applications that expose specific modules, components, or features for the host to consume.</p><p>• <strong>Dynamic-Host Application</strong>:<br> A dynamic-host is a host application capable of dynamically loading remotes at runtime.</p><p><strong>In Angular Native Federation, the key difference between a host and a dynamic host lies in how they handle remote module loading:</strong></p><p><strong>Host:</strong></p><p>• <strong>Static Configuration:</strong> The host application knows about the remote modules it will load at build time.<br> • <strong>Configuration in </strong><strong>webpack.config.js:</strong> The configuration for loading remotes is typically defined within the webpack.config.js file of the host application.<br> • <strong>Build-Time Dependency:</strong> The host application&#39;s build process includes the necessary information about the remote modules.</p><p><strong>Dynamic Host:</strong></p><p>• <strong>Runtime Configuration:</strong> The host application determines which remote modules to load at runtime.<br> • <strong>Configuration in a Separate File:</strong> The configuration for loading remotes is usually stored in a separate JSON file (e.g., federation.manifest.json).<br> • <strong>Flexibility:</strong> This approach offers greater flexibility, as the host can dynamically adapt to changes in the available remote modules without requiring a rebuild.</p><p><strong>In essence:</strong></p><p>• A <strong>host</strong> has a predefined set of remote modules that it loads during the build process.<br> • A <strong>dynamic host</strong> can load different remote modules based on runtime conditions, making it more adaptable and flexible.</p><p>By using a dynamic host, you can centralize the management of remote module configurations, making it easier to update and maintain.</p><p><strong>In summary:</strong></p><p>Choose a host or dynamic host based on your specific needs and the level of flexibility required in your application. If you have a fixed set of remote modules that won’t change frequently, a static host might be sufficient. However, if you need to dynamically load different remote modules based on user interactions or other runtime conditions, a dynamic host provides a more adaptable solution.</p><h3>Module Federation vs. Native Federation</h3><h4>Module Federation</h4><p>Module Federation, introduced in Webpack 5, revolutionized micro frontend architecture by allowing dynamic runtime loading of modules between applications. However, it requires Webpack as the bundler, which may not align with modern applications using faster alternatives like esbuild or Vite.</p><h4>Native Federation</h4><p>Native Federation offers a bundler-agnostic solution built on web standards like ECMAScript modules and Import Maps. It integrates seamlessly with Angular CLI, reducing boilerplate and enhancing the developer experience. It is the recommended approach for projects using Angular 16 and above.</p><h3>Native Federation Configuration</h3><p>Let’s walk through configuring Native Federation for two projects: <strong>main-front</strong> (host) and <strong>micro-front</strong> (remote).</p><p>• Install the Native Federation package:</p><pre>npm install @angular-architects/native-federation@18.2.7 --save-dev</pre><p><strong>Note</strong>: Use a version of @angular-architects/native-federation compatible with your Angular version to avoid dependency errors.</p><p>• Initialize Native Federation for the host application (<strong>main-front</strong>):</p><pre>ng g @angular-architects/native-federation:init --project main-front --port 4200 --type dynamic-host</pre><p>• Repeat the initialization for the remote application (<strong>micro-front</strong>):</p><pre>ng g @angular-architects/native-federation:init --project micro-front --port 4201 --type remote</pre><p>• Add an exception for the generated federation.config.js file in your .eslintrc.json:</p><pre>&quot;ignorePatterns&quot;: [&quot;federation.config.js&quot;]</pre><h3>Configuring the Federation Files</h3><p>For both projects, the federation.config.js file must be configured carefully to avoid dependency resolution issues.</p><h4>Host Application (main-front)</h4><pre>module.exports = withNativeFederation({<br>  shared: {<br>    &#39;@angular/core&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/common&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/common/http&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/router&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/platform-browser&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/core/primitives/signals&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/core/primitives/event-dispatch&#39;: { singleton: true, strictVersion: false },<br>  },<br>});</pre><h4>Remote Application (micro-front)</h4><pre>module.exports = withNativeFederation({<br>  name: &#39;micro-front&#39;,<br>  exposes: {<br>    &#39;./Component&#39;: &#39;./src/app/app.component.ts&#39;,<br>  },<br>  shared: {<br>    &#39;@angular/core&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/common&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/common/http&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/router&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/platform-browser&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/core/primitives/signals&#39;: { singleton: true, strictVersion: false },<br>    &#39;@angular/core/primitives/event-dispatch&#39;: { singleton: true, strictVersion: false },<br>  },<br>});</pre><h3>Resolving Common Issues</h3><p>During setup, you may encounter errors that need careful handling. Here are a few common issues and their resolutions:</p><p>• <strong>Issue 1: 404 Errors for Remote Modules</strong><br> Error example:</p><blockquote>GET <a href="http://localhost:4201/Component.js">http://localhost:4201/Component.js</a> 404 (Not Found)</blockquote><p><strong>Solution:</strong><br> Ensure the exposed components in the federation.config.js file of the remote app match the requested path in the host app.</p><p>• <strong>Issue 2: Dependency Injection Errors</strong><br> Error example:</p><blockquote>NG0203: inject() must be called from an injection context…</blockquote><p><strong>Solution:</strong><br> Make sure shared dependencies are configured identically in both host and remote applications. Explicitly list the shared libraries instead of using shareAll to avoid dependency conflicts.</p><p>• <strong>Issue 3: Missing Angular Primitives</strong><br> Error example:</p><blockquote>Unable to resolve specifier ‘@angular/core/primitives/signals’…</blockquote><p><strong>Solution:</strong><br> Add missing Angular primitives (like @angular/core/primitives/signals) to the shared dependencies in both federation.config.js files.</p><h3>Key Takeaways</h3><p>To avoid dependency issues:</p><p>• Explicitly share libraries instead of relying on shareAll.<br> • Maintain version parity for shared libraries across host and remote applications.<br> • Carefully review federation.config.js in both host and remote apps to ensure consistent configurations.</p><h3>Loading Remote Modules in Angular: Dynamic and Routing Approaches with Native Federation</h3><p>When working with Micro-Frontend architecture, Native Federation enables seamless loading of remote modules without additional tools like Webpack Module Federation. Angular supports this natively, allowing dynamic integration of remote components. This article explains two approaches: adding a remote module to routing and dynamically loading it in a component.</p><p>• <strong>Adding the Remote Component to the Routing Module</strong><br> With Native Federation, you can load remote modules directly in the AppRoutingModule using the loadComponent method for your routes. Here’s an example:</p><pre>const routes: Routes = [<br>  {<br>    path: &#39;micro-test&#39;,<br>    loadComponent: () =&gt;<br>      loadRemoteModule({<br>        remoteEntry: &#39;http://localhost:4201/remoteEntry.json&#39;,<br>        remoteName: &#39;micro-front&#39;,<br>        exposedModule: &#39;./Component&#39;,<br>      }).then((m) =&gt; m.AppComponent),<br>  },<br>];</pre><pre>@NgModule({<br>  imports: [RouterModule.forRoot(routes)],<br>  exports: [RouterModule],<br>})<br>export class AppRoutingModule {}</pre><p><strong>Key Points:</strong></p><p>• remoteEntry: Specifies the entry point of the remote module.<br> • remoteName: Refers to the name of the remote application.<br> • exposedModule: Identifies the specific module or component to expose.</p><p>This method provides a clean, router-integrated experience for remote modules.</p><p>• <strong>Dynamically Loading the Remote Component in a Component</strong><br> For more granular control, you can dynamically load a remote component into a ViewContainerRef.</p><p>Here’s an example of a RemoteRendererComponent:</p><pre>export class RemoteRendererComponent implements OnInit, OnDestroy {<br>  @ViewChild(&#39;remoteContainer&#39;, { read: ViewContainerRef, static: true })<br>  container!: ViewContainerRef;<br>  private componentRef: ComponentRef&lt;any&gt; | null = null;<br>  isLoading = true;<br>  error: string | null = null;</pre><pre>  constructor(private microfrontendService: MicrofrontendService) {}</pre><pre>  async ngOnInit() {<br>    try {<br>      this.isLoading = true;<br>      this.error = null;</pre><pre>      // Specify the port of the remote module<br>      const port = &#39;4201&#39;;</pre><pre>      // Dynamically load the remote component<br>      const module = await this.microfrontendService.loadRemoteComponent(port);<br>      const componentType = module.AppComponent;</pre><pre>      // Clear the container and load the component<br>      this.container.clear();<br>      this.componentRef = this.container.createComponent(componentType);<br>      this.componentRef.changeDetectorRef.detectChanges();<br>    } catch (error) {<br>      console.error(&#39;Failed to load remote component:&#39;, error);<br>      this.error = &#39;Failed to load remote component. Please try again later.&#39;;<br>    } finally {<br>      this.isLoading = false;<br>    }<br>  }</pre><pre>  ngOnDestroy() {<br>    if (this.componentRef) {<br>      this.componentRef.destroy();<br>    }<br>  }<br>}</pre><p>• <strong>The MicrofrontendService</strong><br> Here’s the service for loading a remote module dynamically:</p><pre>@Injectable({<br>  providedIn: &#39;root&#39;,<br>})<br>export class MicrofrontendService {<br>  async loadRemoteComponent(port: string) {<br>    try {<br>      return await loadRemoteModule({<br>        exposedModule: &#39;./Component&#39;,<br>        remoteName: &#39;micro-front&#39;,<br>        remoteEntry: `http://localhost:${port}/remoteEntry.json`,<br>        fallback: &#39;unauthorized&#39;,<br>      });<br>    } catch (err) {<br>      console.error(&#39;Error loading remote component:&#39;, err);<br>      throw err;<br>    }<br>  }<br>}</pre><p><strong>Highlights of the Service:</strong></p><p>• Dynamically constructs the remoteEntry URL based on the port.<br> • Supports error handling with the fallback property.<br> • Ensures the remoteName and exposedModule are configurable.</p><h3>Conclusion</h3><p>Native Federation offers a robust solution for Angular micro frontends, especially when predefined remote entry points are feasible. With proper configurations and dependency management, you can achieve seamless integration between host and remote applications.</p><p>While it may not support dynamic manifests natively, this approach is ideal for projects with fixed or predictable remote URLs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=282fe7bc0418" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Angular Wrapper Component Patterns with PrimeNG]]></title>
            <link>https://isuruiup.medium.com/exploring-angular-wrapper-component-patterns-with-primeng-810accec1a5d?source=rss-51aad4f6124c------2</link>
            <guid isPermaLink="false">https://medium.com/p/810accec1a5d</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[primeng]]></category>
            <dc:creator><![CDATA[Isuru Priyaranjana]]></dc:creator>
            <pubDate>Sun, 29 Sep 2024 18:18:34 GMT</pubDate>
            <atom:updated>2024-09-30T01:35:48.546Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*sEzVCCpL1QztDxheY8SH1Q.jpeg" /></figure><p>In Angular applications, we often come across scenarios where we need to create wrapper components around UI libraries to enhance their functionality, simplify usage, or adapt them to our app’s needs. In this article, we’ll explore a few different patterns for creating wrapper components around PrimeNG components, highlighting their use cases, advantages, and disadvantages.</p><h3>Pattern 1: Directly Wrapping a Component</h3><p>One of the most straightforward approaches is to create a wrapper component that directly wraps another component and exposes its inputs and outputs. This approach works best for simple components but can become cumbersome when the wrapped component has many inputs and outputs.</p><h4>Example: Wrapping PrimeNG’s p-inputTextarea</h4><p>Let’s wrap PrimeNG’s p-inputTextarea component in a custom wrapper component:</p><pre>@Component({<br>  selector: &#39;app-custom-input-textarea&#39;,<br>  template: `<br>    &lt;p-inputTextarea<br>      [rows]=&quot;rows&quot;<br>      [cols]=&quot;cols&quot;<br>      [autoResize]=&quot;autoResize&quot;<br>      (onChange)=&quot;handleChange($event)&quot;<br>    &gt;&lt;/p-inputTextarea&gt;<br>  `,<br>})<br>export class CustomInputTextareaComponent {<br>  @Input() rows = 5;<br>  @Input() cols = 30;<br>  @Input() autoResize = false;<br>  @Output() onChange = new EventEmitter&lt;Event&gt;();<br><br>  handleChange(event: Event) {<br>    this.onChange.emit(event);<br>  }<br>}</pre><h4>Disadvantages:</h4><ul><li><strong>Limited Flexibility</strong>: For every input/output in p-inputTextarea, we need to bind it manually. If PrimeNG updates the component or adds more inputs/outputs, the wrapper component needs to be updated as well.</li><li><strong>Feature Restriction</strong>: By manually binding all inputs/outputs, the wrapper can restrict the component’s full functionality unless you manually add every feature</li></ul><h3>Pattern 2: Wrapping with Templates</h3><p>A more flexible approach is to pass templates as child content within the wrapper. This allows customizable layouts, where the parent can inject content such as headers, footers, or other sections. Here, we’ll show how to wrap PrimeNG’s p-card component, allowing users to pass in templates for the card&#39;s header, content, and footer.</p><p>In this example, we use <strong>directives</strong> for the card header and content but not for the footer. This demonstrates that template projection can be done both with and without directives.</p><h4>Example: Wrapping PrimeNG Card with Custom Templates</h4><p>We wrap p-card and allow users to pass custom templates for the card’s header, content, and footer.</p><pre>@Directive({ selector: &#39;[appCardHeaderTemplate]&#39;, standalone: true })<br>export class CardHeaderTemplateDirective {<br>  constructor(public template: TemplateRef&lt;any&gt;) {}<br>}<br><br>@Directive({ selector: &#39;[appCardContentTemplate]&#39;, standalone: true })<br>export class CardContentTemplateDirective {<br>  constructor(public template: TemplateRef&lt;any&gt;) {}<br>}<br><br>@Component({<br>  selector: &#39;app-custom-card&#39;,<br>  template: `<br>    &lt;p-card&gt;<br>      &lt;!-- Card Header Template --&gt;<br>      &lt;ng-template *ngIf=&quot;cardHeaderTemplate&quot; pTemplate=&quot;header&quot;&gt;<br>        &lt;ng-container [ngTemplateOutlet]=&quot;cardHeaderTemplate&quot;&gt;&lt;/ng-container&gt;<br>      &lt;/ng-template&gt;<br><br>      &lt;!-- Card Content Template --&gt;<br>      &lt;ng-template *ngIf=&quot;cardContentTemplate&quot;&gt;<br>        &lt;ng-container [ngTemplateOutlet]=&quot;cardContentTemplate&quot;&gt;&lt;/ng-container&gt;<br>      &lt;/ng-template&gt;<br><br>      &lt;!-- Card Footer Template (without directive) --&gt;<br>      &lt;ng-template *ngIf=&quot;cardFooterTemplate&quot; pTemplate=&quot;footer&quot;&gt;<br>        &lt;ng-container [ngTemplateOutlet]=&quot;cardFooterTemplate&quot;&gt;&lt;/ng-container&gt;<br>      &lt;/ng-template&gt;<br>    &lt;/p-card&gt;<br>  `,<br>})<br>export class CustomCardComponent {<br>  @ContentChild(CardHeaderTemplateDirective, { read: TemplateRef })<br>  cardHeaderTemplate!: TemplateRef&lt;any&gt;;<br><br>  @ContentChild(CardContentTemplateDirective, { read: TemplateRef })<br>  cardContentTemplate!: TemplateRef&lt;any&gt;;<br><br>  @ContentChild(&#39;appCardFooterTemplate&#39;, { read: TemplateRef })<br>  cardFooterTemplate!: TemplateRef&lt;any&gt;;<br>}</pre><h4>Usage:</h4><p>In the consumer’s template, you can specify the card’s header, content, and footer. Notice that for the header and content, we use the custom directive selectors, while for the footer, we directly use ng-template without a directive.</p><pre>&lt;app-custom-card&gt;<br>  &lt;!-- Card Header --&gt;<br>  &lt;ng-template appCardHeaderTemplate&gt;<br>    &lt;h3&gt;Custom Card Header&lt;/h3&gt;<br>  &lt;/ng-template&gt;<br><br>  &lt;!-- Card Content --&gt;<br>  &lt;ng-template appCardContentTemplate&gt;<br>    &lt;p&gt;This is the custom card content.&lt;/p&gt;<br>  &lt;/ng-template&gt;<br><br>  &lt;!-- Card Footer (no directive) --&gt;<br>  &lt;ng-template #appCardFooterTemplate&gt;<br>    &lt;button&gt;Action&lt;/button&gt;<br>  &lt;/ng-template&gt;<br>&lt;/app-custom-card&gt;</pre><h3>Advantages:</h3><ul><li><strong>Explicit Content Placement</strong>: By using custom directives like appCardHeaderTemplate and appCardContentTemplate, it&#39;s clear which parts of the card are customizable.</li><li><strong>Flexibility</strong>: The footer template is passed without using a directive, showing that you can handle templates both with and without structural directives.</li></ul><h3>Pattern 3: Passing the Entire Component with ng-content</h3><p>In some cases, you might not need to explicitly bind or manage inputs/outputs. Instead, you can simply pass the entire component as ng-content. This approach avoids the need to expose specific inputs/outputs, allowing users to directly interact with the component inside the wrapper.</p><h4>Example: Passing PrimeNG InputTextarea with ng-content</h4><p>In this example, we wrap PrimeNG’s p-inputTextarea inside a custom wrapper component and allow users to customize it via ng-content.</p><pre>@Component({<br>  selector: &#39;app-custom-wrapper&#39;,<br>  template: `<br>    &lt;div class=&quot;wrapper-container&quot;&gt;<br>      &lt;ng-content&gt;&lt;/ng-content&gt;<br>    &lt;/div&gt;<br>  `,<br>})<br>export class CustomWrapperComponent {}</pre><p>Usage:</p><pre>&lt;app-custom-wrapper&gt;<br>  &lt;p-inputTextarea [rows]=&quot;6&quot; [cols]=&quot;50&quot; autoResize=&quot;true&quot;&gt;&lt;/p-inputTextarea&gt;<br>&lt;/app-custom-wrapper&gt;</pre><h3>Advantages:</h3><ul><li><strong>No Need to Expose Inputs/Outputs</strong>: Since the component is passed directly as content, there’s no need to bind inputs/outputs manually. The parent component can control the child component’s properties directly.</li><li><strong>Simplicity</strong>: This approach requires minimal setup, making it a good option for straightforward use cases.</li></ul><h3>Conclusion</h3><p>In this article, we explored three different patterns for creating wrapper components around PrimeNG components:</p><ol><li><strong>Direct Wrapping</strong>: Simple but can restrict functionality and require manual input/output binding.</li><li><strong>Template Wrapping with Directives</strong>: Flexible and allows explicit content placement but adds complexity with custom directives.</li><li><strong>Passing Components via </strong><strong>ng-content</strong>: The simplest and most flexible approach, but not suitable for complex or highly controlled scenarios.</li></ol><p>Each pattern serves different use cases, and the best choice depends on the complexity of the component and the level of customization required. By combining these approaches, you can create reusable, maintainable, and flexible components in your Angular applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=810accec1a5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>