ionic-team / ionic-team/ionic-framework

bug: Angular: Can't bind to 'content-id' since it isn't a known property of 'ion-segment-button'

未关闭
#30,095 2 条评论 0 个 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

When I want to bind the content-id property to a ion-segment-button for a dynamically made ion-segment-content, I can't, and I have this error:
```
ERROR
src/app/nutrition/recette/recette.page.html:154:60 - error NG8002: Can't bind to 'content-id' since it isn't a known property of 'ion-segment-button'.
1. If 'ion-segment-button' is an Angular component and it has 'content-id' input, then verify that it is part of this module.
2. If 'ion-segment-button' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.

154

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/app/nutrition/recette/recette.page.ts:8:16

8 templateUrl: './recette.page.html',

~~~~~~~~~~~~~~~~~~~~~

Error occurs in the template of component RecettePage.
```

### Expected Behavior

I expect ion-segment-button to have the content-id property bindable, so I can have multiples similar pages with a segment-content which have a dynamic id (like this: )

### Steps to Reproduce

just try to bind a content-id property to an ion-segment-button component.

### Code Reproduction URL

https://stackblitz.com/edit/angular-mfulfg51?file=src%2Fapp%2Fexample.component.ts

### Ionic Info

Ionic:

Ionic CLI : 6.20.3 (C:\Users\robin\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : 8.4.1
@angular-devkit/build-angular : 18.2.12
@angular-devkit/schematics : 18.2.12
@angular/cli : 18.2.12
@ionic/angular-toolkit : 11.0.1

Capacitor:

Capacitor CLI : 6.2.0
@capacitor/android : not installed
@capacitor/core : 6.2.0
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v22.4.1 (C:\Program Files\nodejs\node.exe)
npm : 10.8.1
OS : Windows 10

### Additional Information

_No response_

贡献指南

打开贡献指南

调研方向

Start with the linked StackBlitz reproduction and the binding shown in src/app/nutrition/recette/recette.page.html, then trace how ion-segment-button exposes its properties to Angular. Confirm the fix by making the dynamic content-id binding compile successfully and preserving the matching ion-segment-content id behavior.

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

评估

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

把新 issue 发到你的邮箱

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