Skip to content

Commit abb1c6f

Browse files
committed
refactor(@schematics/angular): use control flow to reduce code
This commit uses control flow to reduces code in the template (cherry picked from commit be6ef55)
1 parent 81e4917 commit abb1c6f

File tree

1 file changed

+26
-94
lines changed

1 file changed

+26
-94
lines changed

packages/schematics/angular/application/files/common-files/src/app/app.component.html.template

Lines changed: 26 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -237,101 +237,33 @@
237237
<div class="divider" role="separator" aria-label="Divider"></div>
238238
<div class="right-side">
239239
<div class="pill-group">
240-
<a
241-
class="pill"
242-
href="http://angular.dev"
243-
target="_blank"
244-
rel="noopener"
245-
>
246-
<span> Explore the Docs </span>
247-
<svg
248-
xmlns="http://www.w3.org/2000/svg"
249-
height="14"
250-
viewBox="0 -960 960 960"
251-
width="14"
252-
fill="currentColor"
253-
>
254-
<path
255-
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
256-
/>
257-
</svg>
258-
</a>
259-
<a
260-
class="pill"
261-
href="http://angular.dev/tutorials"
262-
target="_blank"
263-
rel="noopener"
264-
>
265-
<span> Learn with Tutorials </span>
266-
<svg
267-
xmlns="http://www.w3.org/2000/svg"
268-
height="14"
269-
viewBox="0 -960 960 960"
270-
width="14"
271-
fill="currentColor"
272-
>
273-
<path
274-
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
275-
/>
276-
</svg>
277-
</a>
278-
<a
279-
class="pill"
280-
href="http://angular.dev/tools/cli"
281-
target="_blank"
282-
rel="noopener"
283-
>
284-
<span> CLI Docs </span>
285-
<svg
286-
xmlns="http://www.w3.org/2000/svg"
287-
height="14"
288-
viewBox="0 -960 960 960"
289-
width="14"
290-
fill="currentColor"
291-
>
292-
<path
293-
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
294-
/>
295-
</svg>
296-
</a>
297-
<a
298-
class="pill"
299-
href="http://angular.dev/tools/language-service"
300-
target="_blank"
301-
rel="noopener"
302-
>
303-
<span> Angular Language Service </span>
304-
<svg
305-
xmlns="http://www.w3.org/2000/svg"
306-
height="14"
307-
viewBox="0 -960 960 960"
308-
width="14"
309-
fill="currentColor"
240+
@for (item of [
241+
{ title: 'Explore the Docs', link: 'https://angular.dev' },
242+
{ title: 'Learn with Tutorials', link: 'https://angular.dev/tutorials' },
243+
{ title: 'CLI Docs', link: 'https://angular.dev/tools/cli' },
244+
{ title: 'Angular Language Service', link: 'https://angular.dev/tools/language-service' },
245+
{ title: 'Angular DevTools', link: 'https://angular.dev/tools/devtools' },
246+
]; track item.title) {
247+
<a
248+
class="pill"
249+
href="{{ item.link }}"
250+
target="_blank"
251+
rel="noopener"
310252
>
311-
<path
312-
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
313-
/>
314-
</svg>
315-
</a>
316-
<a
317-
class="pill"
318-
href="http://angular.dev/tools/dev-tools"
319-
target="_blank"
320-
rel="noopener"
321-
>
322-
<span> Angular DevTools </span>
323-
<svg
324-
xmlns="http://www.w3.org/2000/svg"
325-
height="14"
326-
viewBox="0 -960 960 960"
327-
width="14"
328-
fill="currentColor"
329-
>
330-
<path
331-
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
332-
/>
333-
</svg>
334-
</a>
253+
<span>{{ item.title }}</span>
254+
<svg
255+
xmlns="http://www.w3.org/2000/svg"
256+
height="14"
257+
viewBox="0 -960 960 960"
258+
width="14"
259+
fill="currentColor"
260+
>
261+
<path
262+
d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h280v80H200v560h560v-280h80v280q0 33-23.5 56.5T760-120H200Zm188-212-56-56 372-372H560v-80h280v280h-80v-144L388-332Z"
263+
/>
264+
</svg>
265+
</a>
266+
}
335267
</div>
336268
<div class="social-links">
337269
<a

0 commit comments

Comments
 (0)