<?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 Flávio Banyai on Medium]]></title>
        <description><![CDATA[Stories by Flávio Banyai on Medium]]></description>
        <link>https://medium.com/@fbanyai?source=rss-a65e73cfecde------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*zXe1Jdoo_D227mF0.jpg</url>
            <title>Stories by Flávio Banyai on Medium</title>
            <link>https://medium.com/@fbanyai?source=rss-a65e73cfecde------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 22:19:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fbanyai/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[Lost All My GCP Projects After a Workspace Domain Migration — Here's How I Got Them Back]]></title>
            <link>https://medium.com/@fbanyai/lost-all-my-gcp-projects-after-a-workspace-domain-migration-heres-how-i-got-them-back-f1afc539647c?source=rss-a65e73cfecde------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1afc539647c</guid>
            <category><![CDATA[google-workspace]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Flávio Banyai]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 12:05:05 GMT</pubDate>
            <atom:updated>2026-02-13T12:05:05.800Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5l9fPE4LRKuR2hBVE0bUcg.jpeg" /></figure><h3>How I Lost Access to All My Google Cloud Projects After a Workspace Domain Migration — And How I Got Them Back</h3><p><strong>A cautionary tale about what happens when Google Workspace and Google Cloud don’t talk to each other.</strong></p><p>I’m a software developer running a multi-tenant SaaS platform on Google Cloud. I have dozens of Cloud Run services across multiple projects — APIs, CMS platforms, crawlers, web apps — all running in production. One day, I made a routine domain migration in Google Workspace. What followed was a nightmare that took me through two unhelpful support teams, a dead end after dead end, and ultimately a manual recovery that Google’s own documentation barely covers.</p><p>This is the story of how I lost everything, got bounced between support teams, and eventually recovered all my Cloud Run services across multiple projects using nothing but gcloud CLI commands and an old service account key file.</p><h3>The Setup</h3><p>My Google Workspace was originally set up under the domain <strong>oldcompany.com</strong>. My admin email was admin@oldcompany.com, and all my GCP resources — the organization, projects, Cloud Run services, Cloud SQL databases, VPC networks — were tied to this identity.</p><p>I decided to restructure my business. The new parent company would operate under a different domain (newcompany.com), with the old company becoming a subsidiary. In Google Workspace terms, this meant changing the primary domain from oldcompany.com to newcompany.com and making oldcompany.com a user alias domain. My email changed from admin@oldcompany.com to admin@newcompany.com.</p><p>Simple enough in Workspace. Catastrophic in GCP.</p><h3>The Moment Everything Disappeared</h3><p>After the migration, I opened the Google Cloud Console and saw… nothing. No projects, no organization, no Cloud Run services. Just an empty dashboard.</p><p>I tried logging in with my old email (admin@oldcompany.com) — it didn&#39;t work at all. I tried the new email (admin@newcompany.com) — it showed a brand new, empty organization called newcompany.com. None of my projects were visible.</p><p>My production services were still running (customers could access them), but I couldn’t manage, deploy, or update anything.</p><h3>The Support Runaround</h3><p>I contacted <strong>Google Cloud Support</strong> first. After explaining the situation, they responded:</p><blockquote><em>“As the issue stems from the primary domain transition and how your identities are mapped between oldcompany.com and newcompany.com, the configuration must be addressed at the Google Workspace level. […] I will be closing this case on our end.”</em></blockquote><p>So I contacted <strong>Google Workspace Support</strong>. Their response:</p><blockquote><em>“Unfortunately, due to Google Cloud Platform not being a part of the core suite of Google Workspace Services, I do not have a clear resolution to your query.”</em></blockquote><p>Cloud told me to talk to Workspace. Workspace told me to talk to Cloud. Classic.</p><h3>Understanding the Root Cause</h3><p>To fix this, I first needed to understand what actually happened at a technical level.</p><p>When you change the primary domain in Google Workspace from oldcompany.com to newcompany.com, several things happen:</p><ol><li><strong>The GCP organization is renamed</strong>, not duplicated. The same org ID now shows as newcompany.com instead of oldcompany.com.</li><li><strong>The old user identity is deleted.</strong> admin@oldcompany.com ceases to exist as a real user. It becomes just an alias.</li><li><strong>All IAM bindings become orphaned.</strong> Every role that was assigned to admin@oldcompany.com now points to deleted:user:admin@oldcompany.com?uid=XXXX — a phantom identity.</li><li><strong>The new identity has no bindings.</strong> admin@newcompany.com is treated as a completely new user with zero permissions on existing resources.</li><li><strong>Projects become invisible.</strong> Without IAM bindings, gcloud projects list returns nothing, and the Cloud Console shows an empty org.</li></ol><p>The critical insight is that the <strong>organization wasn’t lost</strong> — it was the same org the whole time. The projects were still there, still running, still billing. They were just invisible because the only user with access had been deleted.</p><h3>The Recovery: Step by Step</h3><p>Here’s exactly how I recovered everything, in case this happens to you.</p><h3>Step 1: Confirm the Identity Deletion</h3><pre>gcloud organizations list<br># Output: newcompany.com  XXXXXXXXXXXXX  XXXXXXXXX</pre><pre>gcloud projects list<br># Listed 0 items.</pre><pre>gcloud projects describe my-project<br># ERROR: does not have permission (not &quot;not found&quot; — this means it EXISTS)</pre><p>The “does not have permission” error (rather than “not found”) was the first clue that the projects still existed.</p><h3>Step 2: Find a Service Account Key</h3><p>This was the breakthrough. I found an old service account JSON key file in my project archives.</p><p>Service accounts are not affected by Workspace domain migrations — they live in GCP, not in Workspace. The key still worked:</p><pre>gcloud auth activate-service-account --key-file=my-project-key.json<br># Activated service account credentials for: my-service-account@my-project.iam.gserviceaccount.com</pre><p>However, this service account didn’t have enough permissions to list projects or organizations. But it gave me a project number which I could investigate with my main account.</p><h3>Step 3: Discover the Projects Are in the Same Org</h3><pre>gcloud auth login admin@newcompany.com<br>gcloud projects describe &lt;PROJECT_NUMBER&gt;<br># parent:<br>#   id: &#39;XXXXXXXXXXXXX&#39;<br>#   type: organization</pre><p>This was the key revelation. The project was under the <strong>same org</strong> that shows as newcompany.com. The org was never duplicated. The projects were right there, I just couldn&#39;t see them.</p><h3>Step 4: Grant Yourself Org Admin</h3><p>Since I was already the org Owner (that binding was created automatically during migration), I could escalate my own permissions:</p><pre>gcloud organizations add-iam-policy-binding $ORG_ID \<br>  --member=&quot;user:admin@newcompany.com&quot; \<br>  --role=&quot;roles/resourcemanager.organizationAdmin&quot;</pre><pre>gcloud organizations add-iam-policy-binding $ORG_ID \<br>  --member=&quot;user:admin@newcompany.com&quot; \<br>  --role=&quot;roles/browser&quot;</pre><h3>Step 5: Find All Projects Using Asset Search</h3><p>This is the command that saved me. Even though gcloud projects list showed nothing, the Cloud Asset API can search the entire org hierarchy:</p><pre>gcloud asset search-all-resources \<br>  --scope=organizations/$ORG_ID \<br>  --asset-types=cloudresourcemanager.googleapis.com/Project</pre><p>This returned all my projects (both active and pending deletion). They were there the whole time.</p><h3>Step 6: Grant Owner on Every Project</h3><pre>$projects = @(&quot;project-1&quot;, &quot;project-2&quot;, &quot;project-3&quot;) # all your project IDs</pre><pre>foreach ($p in $projects) {<br>    gcloud projects add-iam-policy-binding $p `<br>      --member=&quot;user:admin@newcompany.com&quot; --role=&quot;roles/owner&quot;<br>}</pre><p>After this, gcloud projects list finally showed all my projects.</p><h3>Step 7: Clean Up Orphaned Bindings</h3><p>The last step was removing all references to the deleted user identity:</p><pre>$deleted = &quot;deleted:user:admin@oldcompany.com?uid=XXXXXXXXXXXXXXXXXXXX&quot;</pre><pre># Remove from all projects<br>foreach ($p in $projects) {<br>    gcloud projects remove-iam-policy-binding $p `<br>      --member=$deleted --role=&quot;roles/owner&quot;<br>}</pre><pre># Remove org-level bindings<br>gcloud organizations remove-iam-policy-binding $ORG_ID `<br>  --member=$deleted --role=&quot;roles/compute.xpnAdmin&quot;<br>gcloud organizations remove-iam-policy-binding $ORG_ID `<br>  --member=$deleted --role=&quot;roles/orgpolicy.policyAdmin&quot;<br>gcloud organizations remove-iam-policy-binding $ORG_ID `<br>  --member=$deleted --role=&quot;roles/resourcemanager.organizationAdmin&quot;</pre><h3>Verification</h3><pre>gcloud projects list<br># All projects visible</pre><pre>gcloud run services list --project=my-project<br># All Cloud Run services listed and accessible</pre><p>All my Cloud Run services across all projects, fully recovered.</p><h3>Lessons Learned</h3><h3>1. Before Any Workspace Domain Migration, Prepare GCP</h3><p>Before changing your primary domain in Google Workspace:</p><ul><li>Grant your <strong>new identity</strong> Owner/Admin roles on the GCP organization and all projects.</li><li>Create a <strong>break-glass admin account</strong> with org-level permissions.</li><li>Document all <strong>project IDs</strong> and the <strong>organization ID</strong>.</li><li>Ensure you have at least one <strong>service account key</strong> stored securely.</li></ul><h3>2. Service Account Keys Are Your Emergency Exit</h3><p>My old service account key file was the linchpin of the entire recovery. Without it, I would have had no way to prove the projects existed or discover the org structure. Keep at least one service account key stored securely outside of GCP for disaster recovery.</p><h3>3. gcloud asset search-all-resources Is Your Best Friend</h3><p>When gcloud projects list shows nothing, the Cloud Asset API can still find resources across the entire organization. This command should be the first thing you try in any &quot;lost projects&quot; scenario.</p><h3>4. Google Support Has a Blind Spot</h3><p>The gap between Google Workspace support and Google Cloud support is real. Neither team has the tools or mandate to handle cross-product identity issues. If this happens to you, frame your support request as an <strong>“orphaned organization recovery”</strong> — this is a defined GCP support workflow that’s harder to deflect.</p><h3>5. The Org Isn’t Duplicated — It’s Renamed</h3><p>This was the most important technical insight. When you change the primary domain, the GCP organization keeps the same ID but changes its display name. The projects stay in the same org. They’re not moved, copied, or orphaned at the org level — they’re just invisible because IAM bindings point to a deleted user.</p><h3>What Google Should Do</h3><p>This entire situation could be prevented if Google Workspace’s domain migration flow included a warning: <em>“You have GCP resources tied to this identity. Please grant alternative access before proceeding.”</em></p><p>Better yet, the migration should automatically create IAM bindings for the new identity that mirror the old one, the same way other Workspace services handle identity transitions.</p><p>Until then, consider this article your insurance policy.</p><p><em>Written on Friday the 13th, 2026 — which turned out to be a lucky day after all.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1afc539647c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swiper 10 & Angular 16 Uncovered]]></title>
            <link>https://medium.com/@fbanyai/swiper-10-angular-16-uncovered-1721bf32dfd6?source=rss-a65e73cfecde------2</link>
            <guid isPermaLink="false">https://medium.com/p/1721bf32dfd6</guid>
            <category><![CDATA[swiper-js]]></category>
            <category><![CDATA[swiper]]></category>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Flávio Banyai]]></dc:creator>
            <pubDate>Mon, 25 Sep 2023 22:20:21 GMT</pubDate>
            <atom:updated>2023-09-25T22:26:58.488Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L5VUklwCtTkAAB0lnE-HgA.jpeg" /></figure><p>I’ve been a Swiper user for a long time but since its version 9 it has completely dropped it’s Angular documentation, letting former Angular users on their own — at least it’s what I felt being an user of both technologies.</p><p>Since then I’ve been lazy to stop and try to decipher how to update everything in order to have the most updated Swiper version running under the most updated Angular version… <strong>UNTIL NOW!</strong> :)</p><p>The idea of this article is to provide a sample tiny project consolidating all the pieces I had to collect over <a href="https://stackoverflow.com/a/75353889/414635">Stack Overflow</a>, GitHub and a lot of trial and error I had made until feel confident that the path I chose to stick with was solid and sustainable in order to have Swiper 10 working with Angular 16.</p><figure><img alt="Preview of the final implementation of Swiper 10 using a thumbnail gallery into my Angular project" src="https://cdn-images-1.medium.com/max/1024/1*g1ml0XmB8DUg-vRkh-Kkmw.png" /><figcaption>View of my final working implementation of Swiper 10 working inside an Angular 16 project</figcaption></figure><h3><strong>TL;DR</strong></h3><p>Go to <a href="https://stackblitz.com/edit/stackblitz-starters-keaszp">https://stackblitz.com/edit/stackblitz-starters-keaszp</a>, take a quick look into the source code of the sample project and be happy! :)</p><h3>Project Setup</h3><p>For the sake of simplicity I won’t enter into how you shall setup your environment, install Angular itself and/or init your Angular project.</p><p>Once you have a working Angular project in your machine…</p><h4>Step 1: Add Swiper to your Angular project</h4><p>Please run the following command in your Angular project root folder — I’m also assuming you have NPM correctly installed in your machine:</p><pre>npm install swiper</pre><h4>Step 2: Edit your app.module.ts</h4><p>As demonstrated in the sample code below you must make <strong>3 modifications</strong> in your app.module.ts file in order to get Swiper correctly instantiated on your project:</p><pre><br>import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from &#39;@angular/core&#39;;<br>import { BrowserModule } from &#39;@angular/platform-browser&#39;;<br><br>import { AppComponent } from &#39;./app.component&#39;;<br>import { SwiperDirective } from &#39;./directives/swiper.directive&#39;;<br><br>// Step 1: Add the following line...<br>import { register } from &#39;swiper/element/bundle&#39;;<br><br>// Step 2: Add the following line...<br>register();<br><br>@NgModule({<br>  declarations: [<br>    AppComponent,<br>    SwiperDirective<br>  ],<br>  imports: [<br>    BrowserModule<br>  ],<br>  providers: [],<br>  bootstrap: [AppComponent],<br><br>  // Step 3: Add the following block...<br>  schemas: [<br>    CUSTOM_ELEMENTS_SCHEMA<br>  ]<br>})<br>export class AppModule { }</pre><h4>Step 3: Create a custom Swiper directive (strongly recommended when working with async pipes)</h4><p>Thanks to <a href="https://stackoverflow.com/users/15479265/just-pilot">Just Pilot</a> who provided a lot of ideas on how to solve this whole Swiper &amp; Angular integration, he also <a href="https://stackoverflow.com/a/75353889/414635">suggested a custom Swiper directive</a> which encapsulates one of the main issues I found when upgrading to Swiper 10: how to link the config: SwiperOptions = {} set inside my controller to the swiper-container element in my view, in the correct moment in the component lifecycle?</p><pre>import { AfterViewInit, Directive, ElementRef, Input } from &#39;@angular/core&#39;;<br>import { SwiperContainer } from &#39;swiper/element&#39;;<br>import { SwiperOptions } from &#39;swiper/types&#39;;<br><br>@Directive({<br>  selector: &#39;[appSwiper]&#39;<br>})<br>export class SwiperDirective implements AfterViewInit {<br>  @Input() config?: SwiperOptions;<br><br>  constructor(private el: ElementRef&lt;SwiperContainer&gt;) { }<br><br>  ngAfterViewInit(): void {<br>    Object.assign(this.el.nativeElement, this.config);<br><br>    this.el.nativeElement.initialize();<br>  }<br>}</pre><p>As you can see by using this “directive approach” it only gets called when Swiper is finally linked to the component. And most important of all: <strong>if you use async pipes, this is the way to go!</strong></p><blockquote>Believe me, I had spent a lot of time until I realized my integration wasn’t working because the swiper-container element in my view still even existed due to the fact it was inside an async pipe (which actually is a good practice and the recommended way to fill your view with data).</blockquote><p>Until adopting this “directive approach” I was trying to work with AfterViewChecked event handling within my controller but wasn’t satisfied by manually having to check if the swiper-container was already linked to Swiper.</p><h4>Step 4) Create a simple model</h4><p>Here’s a sample model structure I created for this demo:</p><pre>export interface Card {<br>  title: string;<br>  description: string;<br>  url: string;<br>}</pre><p><strong>IMPORTANT</strong>: this model structure is just a suggestion and you should use your own data structure in your project.</p><h4>Step 5) Create the controller</h4><pre>import { AfterViewInit, Component, ElementRef, ViewChild } from &#39;@angular/core&#39;;<br>import { SwiperContainer } from &#39;swiper/element&#39;;<br>import { SwiperOptions } from &#39;swiper/types&#39;;<br>import { Card } from &#39;./models/card.model&#39;;<br><br>@Component({<br>  selector: &#39;app-root&#39;,<br>  templateUrl: &#39;./app.component.html&#39;<br>})<br>export class AppComponent implements AfterViewInit {<br><br>  @ViewChild(&#39;swiper&#39;) swiper!: ElementRef&lt;SwiperContainer&gt;;<br>  @ViewChild(&#39;swiperThumbs&#39;) swiperThumbs!: ElementRef&lt;SwiperContainer&gt;;<br><br>  contents: Card[] = [<br>    {<br>      title: &#39;Computer&#39;,<br>      description: &#39;Description about computer...&#39;,<br>      url: &#39;https://picsum.photos/id/1/640/480&#39;,<br>    },<br>    {<br>      title: &#39;Building&#39;,<br>      description: &#39;Building description...&#39;,<br>      url: &#39;https://picsum.photos/id/101/640/480&#39;,<br>    }, {<br>      title: &#39;Glass over a computer&#39;,<br>      description: &#39;Description of a glass over a computer&#39;,<br>      url: &#39;https://picsum.photos/id/201/640/480&#39;,<br>    }, {<br>      title: &#39;Autumn&#39;,<br>      description: &#39;Description about autumn leaves&#39;,<br>      url: &#39;https://picsum.photos/id/301/640/480&#39;,<br>    }, {<br>      title: &#39;Balloon&#39;,<br>      description: &#39;Coloured balloon&#39;,<br>      url: &#39;https://picsum.photos/id/401/640/480&#39;,<br>    },<br>  ];<br><br>  index = 0;<br><br>  // Swiper<br>  swiperConfig: SwiperOptions = {<br>    spaceBetween: 10,<br>    navigation: true,<br>  }<br><br>  swiperThumbsConfig: SwiperOptions = {<br>    spaceBetween: 10,<br>    slidesPerView: 4,<br>    freeMode: true,<br>    watchSlidesProgress: true,<br>  }<br><br>  ngAfterViewInit() {<br>    this.swiper.nativeElement.swiper.activeIndex = this.index;<br>    this.swiperThumbs.nativeElement.swiper.activeIndex = this.index;<br>  }<br><br>  slideChange(swiper: any) {<br>    this.index = swiper.detail[0].activeIndex;<br>  }<br><br>}</pre><p>Please note that the contents object is not an async list that comes from an API call — which is much probably your scenario. Not showing how to call an API doesn’t make a big difference for this demo and keeps things simpler.</p><p><strong>OPTIONAL</strong>: the index variable is used to store the current selected slide so the view can show the current slide title and description properties. This index variable could be a RxJS subject as well…</p><h4>Step 6: Create the view</h4><p>Many important things to take notice regarding the proposed view:</p><ul><li>The appSwiper is the reference to the directive we made in <strong>step 3</strong>;</li><li>The #swiper and #swiperThumbs attributes are the references to the ElementRef items we added to the controller in <strong>step 4</strong>;</li><li>The [config] attributes are references to the SwiperOptions variables also set in the controller in <strong>step 4</strong>;</li><li>The thumbs-swiper attribute in the first carousel is a reference to link it to the second carousel (as documented <a href="https://swiperjs.com/element#thumbs">here</a>);</li><li>The (slidechange) (<strong>all in lowercase</strong>) is a reference the event handler that I named slideChange()— also present in the controller;</li></ul><pre>&lt;div class=&quot;container-fluid&quot;&gt;<br>  &lt;div class=&quot;row&quot;&gt;<br>    &lt;main class=&quot;col-8 px-0&quot;&gt;<br><br>      &lt;!-- image --&gt;<br>      &lt;swiper-container appSwiper #swiper [config]=&quot;swiperConfig&quot; thumbs-swiper=&quot;.mySwiper2&quot; (slidechange)=&quot;slideChange($event)&quot;&gt;<br>        &lt;swiper-slide *ngFor=&quot;let item of contents&quot;&gt;<br>          &lt;div class=&quot;ratio ratio-4x3&quot; [ngStyle]=&quot;{background: &#39;url(https://medium.com/&#39;%20+%20item.url%20+&#39;) no-repeat top center / contain&#39;}&quot;&gt;&lt;/div&gt;<br>        &lt;/swiper-slide&gt;<br>      &lt;/swiper-container&gt;<br>      &lt;!-- /image --&gt;<br><br>      &lt;!-- thumbnails --&gt;<br>      &lt;swiper-container appSwiper #swiperThumbs [config]=&quot;swiperThumbsConfig&quot; class=&quot;mySwiper2&quot; *ngIf=&quot;contents.length &gt; 1&quot;&gt;<br>        &lt;swiper-slide *ngFor=&quot;let item of contents&quot;&gt;<br>          &lt;div class=&quot;ratio ratio-4x3&quot; role=&quot;button&quot; [ngStyle]=&quot;{background: &#39;url(https://medium.com/&#39;%20+%20item.url%20+&#39;) center / cover&#39;}&quot;&gt;&lt;/div&gt;<br>        &lt;/swiper-slide&gt;<br>      &lt;/swiper-container&gt;<br>      &lt;!-- /thumbnails --&gt;<br><br>    &lt;/main&gt;<br><br>    &lt;!-- description --&gt;<br>    &lt;aside class=&quot;col-4 p-4&quot;&gt;<br><br>      &lt;h3 [textContent]=&quot;contents[index].title&quot;&gt;&lt;/h3&gt;<br>      &lt;p [textContent]=&quot;contents[index].description&quot;&gt;&lt;/p&gt;<br><br>    &lt;/aside&gt;<br>    &lt;!-- /description --&gt;<br><br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><blockquote>The view makes use of a few <a href="https://getbootstrap.com/docs/5.2/getting-started/introduction/">Bootstrap</a> classes in order to get the visual structure working (the CSS is loaded from the index.html file). Feel free to use the styling solution of your choice in your own project.</blockquote><h4>Step 7: Run your project</h4><p>Voilà! Your project should now look like the sample image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ncOIMKJh7ovH5wyJYkBUQ.png" /></figure><p><strong>Y</strong>ou can find a hosted working version of this project (with source code) at <a href="https://stackblitz.com/edit/stackblitz-starters-keaszp">https://stackblitz.com/edit/stackblitz-starters-keaszp</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Fstackblitz-starters-keaszp%3Fembed%3D1&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Fstackblitz-starters-keaszp%3Fembed%3D1&amp;image=https%3A%2F%2Fsocial-img.staticblitz.com%2Fprojects%2Fstackblitz-starters-keaszp%2Fc14accd3f5f09356b884b32571ed96c1&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/23a5e15c2998fb6b52eece149e3cc314/href">https://medium.com/media/23a5e15c2998fb6b52eece149e3cc314/href</a></iframe><h3>Important tips</h3><h4>Update your Typescript version to 5</h4><p>As you can see in this reply by Vladimir Kharlampidi (author of Swiper) to a user having issues with SwiperContainer and SwiperOptions when using Swiper 10:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*DWFMsubrKDfhgulAcNQuVQ.png" /></figure><p>Source: <a href="https://github.com/nolimits4web/swiper/issues/7019#issuecomment-1709568436">https://github.com/nolimits4web/swiper/issues/7019#issuecomment-1709568436</a></p><h4>Add CUSTOM_ELEMENTS_SCHEMA to each module you need using Swiper</h4><p>Even if you use the SharedModule approach (more info <a href="https://angular.io/guide/sharing-ngmodules">here</a>) you have to add the CUSTOM_ELEMENTS_SCHEMA to each module inside your project where you wish to work with Swiper.</p><h4>ngAfterViewInit() is your friend!</h4><p>As you may have noticed the way Swiper is now linked to the project is a bit “shallow” so it takes a few rounds in the components loading lifecycle until Swiper is fully instantiated and linked to the swiper-container element in your view.</p><p>If you need to do anything related to Swiper events setting or methods calling I strongly suggest you to write it inside the ngAfterViewInit() event of your component — or using a Swiper controller (which I still did not test yet).</p><h4>References to the swiper instance in the controller should use ElementRef&lt;SwiperContainer&gt;</h4><p>As you can notice in the <strong>step 5</strong> above the references to both main and thumbnail carousels present in the view uses ElementRef&lt;SwiperContainer&gt;.</p><h4>Events now are all in lowercase</h4><p>This was one that took me forever to discover although it was clearly mentioned in their <a href="https://swiperjs.com/element#events">documentation</a> (my fault). I was almost going crazy using the former slideChange syntax when I finally noticed that the updated way of handling it is using slidechange (all in lowercase).</p><h4>Setting events in your SwiperOptions doesn’t work</h4><p>Not sure if a bug, a limitation, a feature or the lack of knowledge from my side, but I wasn’t able to set events by using SwiperOptions. The way I could set events (in my case, the slidechange event) was:</p><p><strong>Option 1) Using the (slidechange) attribute in your view template:</strong></p><pre>&lt;swiper-container appSwiper #swiper [config]=&quot;config&quot; (slidechange)=&quot;slideChange($event)&quot;&gt;<br>&lt;!-- slides --&gt;<br>&lt;/swiper-container&gt;</pre><p><strong>Option 2) Setting a listener in your controller:</strong></p><pre>import { AfterViewInit, ElementRef, ViewChild } from &#39;@angular/core&#39;;<br>import { SwiperContainer } from &#39;swiper/element&#39;;<br><br>export class MyComponent implements AfterViewInit {<br><br>  @ViewChild(&#39;swiper&#39;) swiper!: ElementRef&lt;SwiperContainer&gt;;<br><br>  index = 0;<br>  <br>  ngAfterViewInit() {<br>    this.swiper.nativeElement.addEventListener(&#39;slidechange&#39;, (evt) =&gt; this.slideChange(evt));<br>  }<br><br>  slideChange(swiperRef: any) {<br>    this.index = swiperRef.detail[0].activeIndex;<br>  }<br><br>}</pre><p>As you can notice I’m referencing the Swiper component by using the nativeElement property of the swiper object that’s linked to the element in the view using#swiper.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1721bf32dfd6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>