Migrating to Nano Banana 2: Enhancing Your Angular Firebase…
    Neura MarketNeura Market/DeepSeek
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsGamesBlogVideosGuidesCoursesCommunityTrending
    DeepSeekBlogMigrating to Nano Banana 2: Enhancing Your Angular Firebase AI App
    Back to Blog
    Migrating to Nano Banana 2: Enhancing Your Angular Firebase AI App
    angular

    Migrating to Nano Banana 2: Enhancing Your Angular Firebase AI App

    Connie Leung March 31, 2026
    0 views

    Migrating to Nano Banana 2: Enhancing Your Angular Firebase AI App In the rapidly evolving...

    Migrating to Nano Banana 2: Enhancing Your Angular Firebase AI App

    In the rapidly evolving world of AI, staying up-to-date with the latest models is crucial for performance and feature accessibility. In this guide, we’ll walk through the process of migrating an Angular application using Firebase AI Logic to the new Nano Banana 2 model. We will also explore how to implement advanced features like "Thinking Levels," custom aspect ratios, and the use of experimental Angular Signal Forms.

    Introduction

    Nano Banana 2 (often associated with the Gemini 3.1 Flash series) brings significant improvements to image and content generation. Specifically, it introduces:

    • New aspect ratios (8:1 and 1:8).
    • High-resolution options (512px and up).
    • Thinking Levels: Allowing you to toggle between "Minimal" and "High" reasoning for complex generation tasks.

    Let’s dive into the architecture and the code changes required to make this transition.


    Architecture Overview

    The application follows a modern serverless AI architecture, leveraging the Google Cloud and Firebase ecosystem.

    Diagram Description

    1. Angular Frontend: Handles the user interface, prompt input, and displays generated media. It uses Signals for reactive state management.
    2. Firebase Remote Config: Acts as the central brain for model parameters, allowing you to swap model names or reasoning levels without redeploying code.
    3. Firebase AI Logic (Vertex AI for Firebase SDK): The bridge between the frontend and the Gemini/Nano Banana models.
    4. Media Generation: Images generated via Nano Banana 2 can be piped into other models, such as Veo 3.1, to generate high-quality video content.

    Architectural Advice

    For a robust AI application, avoid hardcoding model parameters in your TypeScript files. Use Firebase Remote Config to manage modelName, thinkingLevel, and location. This allows for A/B testing and instant updates if a newer model version becomes available.


    Step 1: Update Firebase Remote Config

    The first step is updating your configuration in the Firebase Console. You need to point the application to the new model and define the thinking levels.

    Key Changes:

    • geminiImageModelName: Update to gemini-3.1-flash-image-preview.
    • thinkingLevel: Set to HIGH or MINIMAL.

    Remote Config JSON (Snippet)

    {
      "geminiImageModelName": "gemini-3.1-flash-image-preview",
      "thinkingLevel": "HIGH",
      "vertexAlLocation": "us-central1"
    }
    

    After updating the console, download the remotemconfig.json and sync it with your local project's default template.


    Step 2: Angular Service Configuration

    In the Angular app, you need to map the Remote Config values to the AI Logic generation parameters.

    firebase.provider.ts

    We update the generation config to include the thinkingLevel. Since this is an enum in the SDK, we map the string from Remote Config.

    function getGenerativeAIImageModel(configService: ConfigService) {
      const { firebaseApp, remoteConfig } = configService.firebaseObjects;
      
      const modelName = getValue(remoteConfig, 'geminiImageModelName').asString();
      const rawThinkingLevel = getValue(remoteConfig, 'thinkingLevel').asString();
      
      // Map string to ThinkingLevel enum
      const thinkingLevel = rawThinkingLevel as keyof typeof ThinkingLevel;
    
      const modelParams: ModelParams = {
        model: modelName,
        generationConfig: {
          candidateCount: 1,
          thinkingConfig: {
            thinkingLevel: ThinkingLevel[thinkingLevel]
          }
        }
      };
    
      return getGenerativeModel(getAI(firebaseApp), modelParams);
    }
    

    Step 3: Prompt Workaround for Aspect Ratio & Resolution

    Currently, some Firebase AI Logic SDKs might not support aspectRatio or resolution as first-class parameters in the generationConfig. A reliable workaround is appending these instructions directly to the prompt.

    prompt-form.component.ts

    onGenerateClick(event: Event) {
      event.preventDefault();
      
      const inputValue = this.promptForm.value.prompt;
      const aspectRatio = this.genConfigValues().aspectRatio;
      const resolution = this.genConfigValues().resolution;
      
      let trimmedPrompt = inputValue;
    
      // Workaround: Append instructions to the prompt
      if (aspectRatio) {
        trimmedPrompt = `${trimmedPrompt} \nApply this aspect ratio to the image: ${aspectRatio}`;
      }
      
      if (resolution) {
        trimmedPrompt = `${trimmedPrompt} \nApply this resolution to the image: ${resolution}`;
      }
    
      this.generate.emit({ trimmedPrompt, inputValue });
    }
    

    Step 4: UI with Experimental Signal Forms

    To handle the dropdown selections for Aspect Ratio and Resolution, the app uses Angular's experimental Signal Forms. This provides a more reactive approach compared to standard Reactive Forms.

    generate-options-form.component.html

    <form [formRoot]="generateConfigForm" class="flex flex-col gap-4">
      <label>Aspect Ratio</label>
      <select [formField]="aspectRatio">
        @for (opt of aspectRatios; track opt) {
          <option [value]="opt">{{ opt }}</option>
        }
      </select>
    
      <label>Resolution</label>
      <select [formField]="resolution">
        @for (opt of resolutions; track opt) {
          <option [value]="opt">{{ opt }}</option>
        }
      </select>
    </form>
    

    Conclusion

    Migrating to Nano Banana 2 allows developers to tap into higher-quality image generation and nuanced reasoning levels. By combining Angular Signals with Firebase Remote Config, you create a flexible architecture that can adapt to the next model update with minimal code changes.

    Happy coding!


    Resources

    • Angular Signal Forms (Experimental)
    • Firebase AI Logic Documentation
    • Google AI Studio
    • Connie Leung on GitHub

    Tags

    angularfirebasegeminitutorial

    Comments

    More Blog

    View all
    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught megemma

    Five Gemma-4 models, one accelerator: what porting E2B 31B to AWS Inferentia2 taught me

    I ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...

    X
    xbill
    Hey DEV, I'm Tobore. Let's actually connect.community

    Hey DEV, I'm Tobore. Let's actually connect.

    Hey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...

    L
    Laurina Ayarah
    I burned through thousands of AI tokens. Then a friend did it for freeai

    I burned through thousands of AI tokens. Then a friend did it for free

    (yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...

    P
    Paulo Henrique
    Claude might be saturating your machineai

    Claude might be saturating your machine

    My laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...

    S
    Sidhant Panda
    Automated GitHub Code Reviews Using Google Geminigithubactions

    Automated GitHub Code Reviews Using Google Gemini

    I Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...

    D
    Darren "Dazbo" Lester
    What is an "agentic harness," actually?ai

    What is an "agentic harness," actually?

    I've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...

    T
    Tilde A. Thurium

    Stay up to date

    Get the latest DeepSeek prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for DeepSeek and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Neura Market

    Custom AI Systems & Services

    Our team of experienced AI builders will help build custom AI systems, workflows, and solutions for your business.

    Request custom work

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this DeepSeek resource

    • Nano Banana AI Image Editor via Telegramn8n · $9.99 · Related topic
    • Automate ISS Position Updates to Firebase Realtime Databasen8n · $4.99 · Related topic
    • Send a Firebase Cloud Messaging topic message/notification from a new row in a Microsoft 365 Excel worksheetmake · $2.99 · Related topic
    • Receive ISS Position Updates and Push to Firebasen8n · $9.99 · Related topic
    Browse all workflows