ionic-team / ionic-team/ionic-framework

bug: IonicSafeString not accepted even after setting innerHTMLTemplatesEnabled to true in Ionic Config

未关闭
#30,111 6 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
triage
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
51

描述

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v8.x

### Current Behavior

Toast has been created with message that should be recognised as HTML, but is shown as undefined even though the ionic config `IonicModule.forRoot({ innerHTMLTemplatesEnabled: true }),`
has been correctly set.

Current behaviour is:
![image](https://github.com/user-attachments/assets/1a511795-d8da-47ea-81e0-370176376e4d)

I have tried v7, v8, both raising same issues

I saw similar issues that have been closed, and I could still not resolve this, even with the ion config being set so I am confused :(

### Expected Behavior

Expected Behaviour should be, the tags should not be shown as plain string in the toast, and shown as a link instead, and not undefined like the current behaviour.

### Steps to Reproduce

Click on any of the buttons in the stackblitz, and you will see the message is undefined instead of a string. (i tried to reproduce what I am seeing in my application in here)

### Code Reproduction URL

https://stackblitz.com/edit/finitelooper-ng16-yzlkcskn?file=src%2Fapp%2Fapp.module.ts

### Ionic Info

Ionic:

Ionic CLI : 5.4.16 (C:\Users\....)
Ionic Framework : not installed
@angular-devkit/build-angular : 16.2.16
@angular-devkit/schematics : 16.2.12
@angular/cli : 16.2.12
@ionic/angular-toolkit : 10.0.0

Utility:

cordova-res : not installed
native

System:

NodeJS : v18.20.4 (C:\Program Files\nodejs\node.exe)
npm : 10.1.0
OS : Windows 10

### Additional Information

Tried to use import { IonicSafeString } from '@ionic/angular/standalone'; has not helped it seems

_No response_

贡献指南

打开贡献指南

调研方向

Start with the StackBlitz reproduction, especially src/app/app.module.ts, and reproduce the toast behavior after reviewing the IonicModule configuration and IonicSafeString import. Trace how the toast message is passed and rendered; done means the configured HTML message renders as a link rather than appearing as undefined or plain text.

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。