Skip to content

Update Angular guide with index.html modifications#5207

Open
deltajoe wants to merge 2 commits intowailsapp:masterfrom
deltajoe:patch-2
Open

Update Angular guide with index.html modifications#5207
deltajoe wants to merge 2 commits intowailsapp:masterfrom
deltajoe:patch-2

Conversation

@deltajoe
Copy link
Copy Markdown

@deltajoe deltajoe commented Apr 21, 2026

Added instructions for modifying the index.html file to include Wails options and scripts for an angular frontend (analog to react frontend). Without this modification the bindings into wails where missing after a hot reload of changed *.ts files.

Tools:
Wails v2.10.1
Angular 21.2.0

Commands in wails.json:

"frontend:install": "npm install",
"frontend:build": "npx ng build",
"frontend:dev:watcher": "npx ng serve",
"frontend:dev:serverUrl": "http://localhost:4200",

The following effect takes place in the browser (chrome latest) and the application itself:

When starting the dev-cycle with wails dev everything works fine and I could invoke the command from the angular app into the wails app. Changing UI elements with hot reload works fine as well. When I change the underlying *.ts file in the angular project, all bindings into the wails app are lost after the hot reload. In the browser and in the app.

If I apply the fix in the index.html as suggested in this PR, everything works fine after the hot reload of transpiled *.ts files. Maybe there is an other solution, but I have not found it.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please select the option that is relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

Please paste the output of wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.

Checklist:

  • I have updated website/src/pages/changelog.mdx with details of this PR
  • My code follows the general coding style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Summary by CodeRabbit

  • Documentation
    • Updated Angular dev mode guide with additional required configuration steps for the app's HTML initialization, including necessary meta tags and Wails client script imports.

Added instructions for modifying the index.html file to include Wails options and scripts. Otherwise the reload for changed *.ts files won't work.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 2026

Walkthrough

Documentation for Angular dev mode updated with required HTML modifications, including a wails-options meta tag and Wails client script imports in the index.html file.

Changes

Cohort / File(s) Summary
Angular Documentation
website/docs/guides/angular.mdx
Added HTML <head> entries for Wails client initialization: meta tag wails-options="noautoinject" and script imports for /wails/ipc.js and /wails/runtime.js. Added trailing newline.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A guide now shines with Wails so bright,
With meta tags and scripts in sight,
No auto-inject, just what we need,
Angular flows at perfect speed! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description provides clear context about the problem and solution, but does not reference a linked issue and several checklist items remain unchecked. Reference a linked issue using 'Fixes #' if one exists, and provide the 'wails doctor' output for the test configuration section.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: updating the Angular guide documentation with index.html modifications, matching the file changes in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
website/docs/guides/angular.mdx (1)

17-23: Clarify the HTML snippet to avoid confusion.

The code block shows <head> and </head> tags, which might mislead users into thinking they need to add a new head section. Consider rewording to make it clearer that these entries should be added within the existing <head> section of their index.html file.

📝 Suggested improvement for clarity
-You also need to change the `index.html` file and add the following entries to your header section:
+You also need to modify your `index.html` file by adding the following entries inside the existing `<head>` section:
 ```html
-<head>
  <meta name="wails-options" content="noautoinject" />
  <script src="/wails/ipc.js"></script>
  <script src="/wails/runtime.js"></script>
-</head>
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @website/docs/guides/angular.mdx around lines 17 - 23, The snippet as shown
includes full and tags and may mislead readers to add a new head
section; update the guide text and the example in angular.mdx to explicitly
state that the meta and script lines must be placed inside the existing
of their index.html (or replace the fenced code block with just the three lines
to be inserted so it’s clear they are meant to be added into the existing
header).


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @website/docs/guides/angular.mdx:

  • Around line 17-23: The snippet as shown includes full and tags
    and may mislead readers to add a new head section; update the guide text and the
    example in angular.mdx to explicitly state that the meta and script lines must
    be placed inside the existing of their index.html (or replace the fenced
    code block with just the three lines to be inserted so it’s clear they are meant
    to be added into the existing header).

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `b0491333-178f-41ab-b426-d2732c898e11`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between b618f81b8c76798cbd9d7b6df2376fb697a601a3 and 6ea3dfb20c885cdc01279280f11114edc79dd8b7.

</details>

<details>
<summary>📒 Files selected for processing (1)</summary>

* `website/docs/guides/angular.mdx`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@leaanthony leaanthony enabled auto-merge May 5, 2026 11:39
@leaanthony
Copy link
Copy Markdown
Member

Thanks for this documentation update! A quick question:

Your PR description says this fixes an issue where *.ts files won't reload, but you haven't tested this on any platforms. Could you:

  1. Confirm which Wails version you're using (v2 or v3)?
  2. Test this on at least one platform (Windows, macOS, or Linux) and update the checklist?
  3. Provide a brief explanation of why the index.html modifications are needed for the reload to work?

Once you've tested this, please update the PR description and we can proceed with review.

@deltajoe
Copy link
Copy Markdown
Author

deltajoe commented May 6, 2026

I have updated the PR description and added some context to understand the problem.

@leaanthony
Copy link
Copy Markdown
Member

Thanks for reporting this issue and proposing a fix! This sounds like a legitimate problem that would affect Angular developers using Wails.

Before I can accept this, I have a few requests:

  1. Link to Issue: Could you please open an issue describing this problem and link it in this PR? This helps us track the issue and provides context for future contributors.

  2. Root Cause Analysis: The fix involves manually modifying index.html. Is this the best long-term solution, or is there a way Wails could handle this automatically? Have you investigated whether this is a configuration issue or a bug in how Wails integrates with Angular's build process?

  3. Cross-Platform Testing: You've tested on macOS. Could you test this on Windows and Linux to ensure the fix works consistently?

  4. Testing Instructions: Please provide clear steps for reproducing the issue and verifying that your fix resolves it. This will help reviewers and future contributors understand the problem and solution.

  5. Complete Checklist: Several items in the checklist are unchecked. Please complete the remaining items where applicable (e.g., self-review, code style).

Decision: COMMENT-AND-WAIT - Awaiting issue link, additional testing, and verification of approach

CC @leaanthony

@leaanthony
Copy link
Copy Markdown
Member

Thanks for this PR! I understand the issue you're trying to solve — bindings are lost after Angular hot reload when *.ts files change.

Before I can accept this, I need to verify that modifying index.html is the correct approach. The issue you're describing sounds like it might be related to how Angular's HMR (Hot Module Replacement) interacts with Wails' dev server, rather than a missing script in index.html.

Could you clarify:

  1. Does the Angular template in the Wails repo already have the Wails script in index.html?
  2. If yes, why would the bindings be lost after hot reload? The script should persist across HMR updates.
  3. Is there a way to fix this in the Angular configuration (angular.json) or wails.json dev server settings instead of requiring manual index.html edits?

I want to make sure we're guiding users to the correct solution rather than a workaround.

CC @leaanthony

@deltajoe
Copy link
Copy Markdown
Author

deltajoe commented May 7, 2026

OK, I will check if there is a solution regarding angular settings. But this will take some time. My guess is, that it has something to do with the usage of the vite compiler toolchain, because in lower versions of angular i didn't had this problem.

Responding to your questions:

Could you clarify:

1. Does the Angular template in the Wails repo already have the Wails script in index.html?

as far as I can see there is no template for angular in the repo and no angular switch on the cli. There are community templates, but they all target very old angular versions.

2. If yes, why would the bindings be lost after hot reload? The script should persist across HMR updates.

3. Is there a way to fix this in the Angular configuration (angular.json) or wails.json dev server settings instead of requiring manual index.html edits?

the react template does exactly the same, maybe for a reason ;-)

I want to make sure we're guiding users to the correct solution rather than a workaround.

CC @leaanthony

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants