Angular schematics generates blank lines through template
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- angular, typescript
Piste de recherche
Reproduisez les lignes vides du modèle schematic inline <% ... %> à l’aide de npm run build et de schematics .:ui-generator --name=hello. Commencez par retracer la manière dont Angular CLI schematics effectue le rendu des commandes de modèle, puis vérifiez que la sortie générée omet les espaces blancs propres aux commandes tout en préservant le contenu environnant.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Command
generate
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
I have ng schematics template __name@dasherize__.component.html with content :
<% for (let row of getComponents().rows) { %> <div class="row"> <% for (let field of row.fields) { %> <% if (field.type === 'InputStrxing') { %> <field labelCode="code" class="col-sm-6 col-md-3"> <input name="code" ngModel [readonly]="readOnly"> </field> <% } %> <% } %> </div> <% } %>
I build it with :
npm run build
schematics .:ui-generator --name=hello
Generated code creates empty lines on place where is put command "<%" in template, see:
<div class="row"> <field labelCode="code" class="col-sm-6 col-md-3"> <input name="code" ngModel [readonly]="readOnly"> </field> <field labelCode="code" class="col-sm-6 col-md-3"> <input name="code" ngModel [readonly]="readOnly"> </field> <field labelCode="code" class="col-sm-6 col-md-3"> <input name="code" ngModel [readonly]="readOnly"> </field> </div>
Is there anyway these white spaces can be avoided. If we have to do it manually, it might kill the purpose of this code generator tool
Minimal Reproduction
Write a schematic template code with inline code <% inline code %>. Then build and generate code using commands
npm run build
schematics .:ui-generator --name=hello
We can see generated code is having while spaces wherever inline code is present.
Exception or Error
No response
Your Environment
ng analytics disable --global
Global setting: enabled
Local setting: No local workspace configuration file.
Effective status: enabled
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 16.2.14
Node: 18.19.1
Package Manager: npm 10.2.4
OS: darwin arm64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1602.14
@angular-devkit/core 16.2.14
@angular-devkit/schematics 16.2.14
@schematics/angular 16.2.14
typescript 5.1.6
Anything else relevant?
No response
- Langage dominant
- TypeScript
- Étoiles
- 27k
- Forks
- 11.8k
- Merge moyen
- 16 h 35 min
- PR mergées (30 j)
- 176
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Ouvertearea: @angular/build gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
angular/angular-cli#33055 · 1 commentaire · 3 réactions ·
-
unit-test: with --coverage, a setup file's hooks reach only the first spec file of each worker Ouvertearea: @angular/build gemini-triaged
Difficulté 4/5 3-5 jours Accessibilité débutants 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 personne assignée ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 personne assignée ·
Toutes les issues de angular/angular-cli
Issues similaires
-
S: triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 90/100
snapshot-labs/stamp#666 ·
-
fix(api): prevent leaderboard SSE heartbeat from starting after disconnect during initial load Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
GauravKarakoti/SecureFlow#1070 · 1 commentaire ·
-
feature:Languages/Translations good first issue ready Web
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
digitalfabrik/integreat-app#4394 ·