mat-icon: To be able to have both svgIcon and fontIcon
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
#### Please describe the feature you would like to request.
Let's say you have a js structure (an array of object) holding a list of icons, some svg, some font with other properties.
In your view you want to have a simple *ngFor to iterate on all your icons.
For svg icons, your object will have a "svg" property.
For font icons, your object will have a "font" property.
The key will be undefined if not set.
Therefore, you will have in your loop something like:
`{{ btn.icon }}`
Sounds pretty easy but that's not working right now (Angular Material 7.3.7).
#### What is the use-case or motivation for this proposal?
To simply KISS
To avoid a fugly:
``
`{{ btn.icon }}`
#### Is there anything else we should know?
For what I saw, the reason about that is located in:
https://github.com/angular/material2/blob/master/src/lib/icon/icon.ts#L224-L244
A quick hack could be :
https://github.com/angular/material2/blob/master/src/lib/icon/icon.ts#L237
`!this._usingFontIcon() && this._clearSvgElement();`
Beitragsleitfaden
Rechercherichtung
Beginne bei src/lib/icon/icon.ts in den Zeilen 224-244 und reproduziere das Problem mit dem im Bericht beschriebenen Angular Material 7.3.7 mat-icon/ngFor-Beispiel. Verfolge die Verarbeitung von svgIcon und fontIcon und überprüfe anschließend, dass ein mat-icon beide Formen ohne bedingte Templates rendern kann, wobei das bestehende Verhalten erhalten bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- frontend
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 38/100