_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
angular/adev/src/content/tutorials/first-app/steps/13-search/src/app/housing-location/housing-location.component.css_0_583
.listing { background: var(--accent-color); border-radius: 30px; padding-bottom: 30px; } .listing-heading { color: var(--primary-color); padding: 10px 20px 0 20px; } .listing-photo { height: 250px; width: 100%; object-fit: cover; border-radius: 30px 30px 0 0; } .listing-location { padding: 10px 20px 20px 20px; } .listing-location::before { content: url("/assets/location-pin.svg") / ""; } section.listing a { padding-left: 20px; text-decoration: none; color: var(--primary-color); } section.listing a::after { content: "\203A"; margin-left: 5px; }
{ "end_byte": 583, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/app/housing-location/housing-location.component.css" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/app/housing-location/housing-location.component.ts_0_908
import {Component, Input} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocation} from '../housinglocation'; import {RouterModule} from '@angular/router'; @Component({ selector: 'app-housing-location', standalone: true, imports: [CommonModule, RouterModule], template: ` <section class="listing"> <img class="listing-photo" [src]="housingLocation.photo" alt="Exterior photo of {{ housingLocation.name }}" crossorigin /> <h2 class="listing-heading">{{ housingLocation.name }}</h2> <p class="listing-location">{{ housingLocation.city }}, {{ housingLocation.state }}</p> <a [routerLink]="['/details', housingLocation.id]">Learn More</a> </section> `, styleUrls: ['./housing-location.component.css'], }) export class HousingLocationComponent { @Input() housingLocation!: HousingLocation; }
{ "end_byte": 908, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/app/housing-location/housing-location.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/app/details/details.component.ts_0_2657
import {Component, inject} from '@angular/core'; import {CommonModule} from '@angular/common'; import {ActivatedRoute} from '@angular/router'; import {HousingService} from '../housing.service'; import {HousingLocation} from '../housinglocation'; import {FormControl, FormGroup, ReactiveFormsModule} from '@angular/forms'; @Component({ selector: 'app-details', standalone: true, imports: [CommonModule, ReactiveFormsModule], template: ` <article> <img class="listing-photo" [src]="housingLocation?.photo" alt="Exterior photo of {{ housingLocation?.name }}" crossorigin /> <section class="listing-description"> <h2 class="listing-heading">{{ housingLocation?.name }}</h2> <p class="listing-location">{{ housingLocation?.city }}, {{ housingLocation?.state }}</p> </section> <section class="listing-features"> <h2 class="section-heading">About this housing location</h2> <ul> <li>Units available: {{ housingLocation?.availableUnits }}</li> <li>Does this location have wifi: {{ housingLocation?.wifi }}</li> <li>Does this location have laundry: {{ housingLocation?.laundry }}</li> </ul> </section> <section class="listing-apply"> <h2 class="section-heading">Apply now to live here</h2> <form [formGroup]="applyForm" (submit)="submitApplication()"> <label for="first-name">First Name</label> <input id="first-name" type="text" formControlName="firstName" /> <label for="last-name">Last Name</label> <input id="last-name" type="text" formControlName="lastName" /> <label for="email">Email</label> <input id="email" type="email" formControlName="email" /> <button type="submit" class="primary">Apply now</button> </form> </section> </article> `, styleUrls: ['./details.component.css'], }) export class DetailsComponent { route: ActivatedRoute = inject(ActivatedRoute); housingService = inject(HousingService); housingLocation: HousingLocation | undefined; applyForm = new FormGroup({ firstName: new FormControl(''), lastName: new FormControl(''), email: new FormControl(''), }); constructor() { const housingLocationId = parseInt(this.route.snapshot.params['id'], 10); this.housingLocation = this.housingService.getHousingLocationById(housingLocationId); } submitApplication() { this.housingService.submitApplication( this.applyForm.value.firstName ?? '', this.applyForm.value.lastName ?? '', this.applyForm.value.email ?? '', ); } }
{ "end_byte": 2657, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/app/details/details.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/app/details/details.component.css_0_1075
.listing-photo { height: 600px; width: 50%; object-fit: cover; border-radius: 30px; float: right; } .listing-heading { font-size: 48pt; font-weight: bold; margin-bottom: 15px; } .listing-location::before { content: url('/assets/location-pin.svg') / ''; } .listing-location { font-size: 24pt; margin-bottom: 15px; } .listing-features > .section-heading { color: var(--secondary-color); font-size: 24pt; margin-bottom: 15px; } .listing-features { margin-bottom: 20px; } .listing-features li { font-size: 14pt; } li { list-style-type: none; } .listing-apply .section-heading { font-size: 18pt; margin-bottom: 15px; } label, input { display: block; } label { color: var(--secondary-color); font-weight: bold; text-transform: uppercase; font-size: 12pt; } input { font-size: 16pt; margin-bottom: 15px; padding: 10px; width: 400px; border-top: none; border-right: none; border-left: none; border-bottom: solid .3px; } @media (max-width: 1024px) { .listing-photo { width: 100%; height: 400px; } }
{ "end_byte": 1075, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/app/details/details.component.css" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/assets/location-pin.svg_0_502
<?xml version="1.0" encoding="UTF-8"?> <svg width="20pt" height="20pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 11.602c-15.398 0-27.898 12.5-27.898 27.898 0 5 1.3008 9.6992 3.6016 13.801l2.8984 4.1992 21.398 30.898 21.801-31.398 2.1992-3.1992c2.5-4.1992 3.8984-9 3.8984-14.199 0-15.5-12.5-28-27.898-28zm0 35.598c-4.1992 0-7.6992-3.3984-7.6992-7.6992s3.3984-7.6992 7.6992-7.6992 7.6992 3.3984 7.6992 7.6992-3.5 7.6992-7.6992 7.6992z" fill="#605cc8"/> </svg>
{ "end_byte": 502, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/assets/location-pin.svg" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg_0_2207
<svg width="151" height="44" viewBox="0 0 151 44" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M6.15532 33.2946C5.25369 33.2946 4.58006 32.5707 4.58006 31.6701V24.0152C4.58006 19.5469 4.35206 20.6276 7.59585 17.4236C21.7317 4.06732 16.2425 4.24744 29.6149 18.054C32.0434 20.7627 31.9985 19.4534 31.9985 23.8316V31.6667C31.9985 32.5707 31.28 33.2912 30.3749 33.2912H6.15532V33.2946Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M30.896 35.1547L5.73676 35.2586C4.80059 35.2621 3.75042 35.8232 3.37388 36.5229L2.90061 37.4027L0.537726 41.7878L0.140457 42.529C-0.236085 43.2253 0.164639 43.7829 1.10081 43.7795L26.26 43.6756C27.1962 43.6721 28.2464 43.111 28.6229 42.4113L29.0962 41.5315L31.4591 37.1463L31.8563 36.4051C32.2329 35.7089 31.8321 35.1512 30.896 35.1547Z" fill="#605DC8"/> <path d="M2.54861 18.7156C2.23079 18.7156 1.90952 18.629 1.6228 18.4454C0.821352 17.9363 0.5899 16.859 1.09771 16.0554C1.46389 15.4701 2.70061 14.2231 5.50912 11.4659L6.39693 10.5931C8.73218 8.38318 10.5147 6.56817 11.9449 5.10646C15.1679 1.81587 16.7985 0.153263 18.9023 0.222538C20.9888 0.277958 22.4362 1.92325 25.3138 5.19651C26.7267 6.8037 28.4816 8.8023 30.8514 11.2477C30.8652 11.265 30.8825 11.2789 30.8963 11.2962C31.228 11.6634 31.715 12.2003 32.2401 12.7752C33.9743 14.6734 34.8206 15.6086 35.0763 15.9688C35.629 16.7413 35.4494 17.8185 34.679 18.3727C33.9087 18.9234 32.8343 18.7468 32.2816 17.9744C32.0639 17.6869 30.5889 16.0693 29.708 15.1064C29.1863 14.5348 28.6993 14.0014 28.3642 13.6308C25.9495 11.1369 24.1704 9.11057 22.7368 7.4826C21.0233 5.5325 19.4032 3.68977 18.809 3.67245H18.8021C18.1699 3.67245 16.3356 5.54289 14.3976 7.52417C12.9467 9.00666 11.14 10.8494 8.78054 13.0766L7.91001 13.9321C6.74929 15.0717 4.33804 17.4375 3.97877 17.9293C3.65405 18.4454 3.10824 18.7225 2.54515 18.7225L2.54861 18.7156Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M22.0976 33.2115V26.0588C22.0976 25.4665 21.6174 24.985 21.0267 24.985H15.1955C14.6047 24.985 14.1246 25.4665 14.1246 26.0588V33.2115C14.1246 33.2704 14.1142 33.3293 14.0969 33.3847H22.1252C22.1079 33.3293 22.0976 33.2739 22.0976 33.2115Z" fill="white"/>
{ "end_byte": 2207, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg_2208_5628
<path d="M58.9784 10.0512V32.2205H54.5319V22.7874H45.0353V32.2205H40.5887V10.0512H45.0353V19.1666H54.5319V10.0512H58.9784ZM70.8506 32.5063C69.1567 32.5063 67.6322 32.1358 66.277 31.3947C64.9219 30.6324 63.8526 29.5631 63.0692 28.1868C62.3069 26.8105 61.9258 25.2224 61.9258 23.4226C61.9258 21.6228 62.3175 20.0348 63.1009 18.6585C63.9055 17.2821 64.996 16.2234 66.3723 15.4823C67.7486 14.7201 69.2838 14.3389 70.9777 14.3389C72.6716 14.3389 74.2067 14.7201 75.5831 15.4823C76.9594 16.2234 78.0393 17.2821 78.8227 18.6585C79.6273 20.0348 80.0296 21.6228 80.0296 23.4226C80.0296 25.2224 79.6167 26.8105 78.7909 28.1868C77.9863 29.5631 76.8853 30.6324 75.4878 31.3947C74.1115 32.1358 72.5657 32.5063 70.8506 32.5063ZM70.8506 28.6315C71.6553 28.6315 72.4069 28.4409 73.1057 28.0597C73.8256 27.6574 74.3973 27.0646 74.8208 26.2811C75.2443 25.4977 75.456 24.5449 75.456 23.4226C75.456 21.7499 75.0114 20.4688 74.122 19.5795C73.2539 18.669 72.1846 18.2138 70.9142 18.2138C69.6437 18.2138 68.5744 18.669 67.7063 19.5795C66.8593 20.4688 66.4358 21.7499 66.4358 23.4226C66.4358 25.0954 66.8487 26.387 67.6745 27.2975C68.5215 28.1868 69.5802 28.6315 70.8506 28.6315ZM104.825 14.3707C106.985 14.3707 108.721 15.0377 110.034 16.3717C111.368 17.6844 112.035 19.5266 112.035 21.8981V32.2205H107.589V22.5016C107.589 21.1252 107.239 20.0771 106.54 19.3572C105.842 18.6161 104.889 18.2456 103.682 18.2456C102.475 18.2456 101.512 18.6161 100.792 19.3572C100.093 20.0771 99.7436 21.1252 99.7436 22.5016V32.2205H95.297V22.5016C95.297 21.1252 94.9477 20.0771 94.2489 19.3572C93.5502 18.6161 92.5974 18.2456 91.3904 18.2456C90.1623 18.2456 89.1883 18.6161 88.4684 19.3572C87.7697 20.0771 87.4203 21.1252 87.4203 22.5016V32.2205H82.9737V14.6248H87.4203V16.7528C87.992 16.0117 88.7225 15.4294 89.6118 15.0059C90.5223 14.5824 91.5175 14.3707 92.5974 14.3707C93.9737 14.3707 95.2018 14.6671 96.2816 15.26C97.3615 15.8317 98.1979 16.6575 98.7908 17.7374C99.3625 16.721 100.188 15.9058 101.268 15.2918C102.369 14.6777 103.555 14.3707 104.825 14.3707ZM132.294 23.0415C132.294 23.6767 132.252 24.2484 132.167 24.7566H119.304C119.41 26.027 119.854 27.0222 120.638 27.7421C121.421 28.4621 122.385 28.822 123.528 28.822C125.18 28.822 126.355 28.1127 127.053 26.694H131.849C131.341 28.3879 130.367 29.7854 128.927 30.8865C127.488 31.9664 125.72 32.5063 123.623 32.5063C121.929 32.5063 120.405 32.1358 119.05 31.3947C117.716 30.6324 116.668 29.5631 115.905 28.1868C115.164 26.8105 114.794 25.2224 114.794 23.4226C114.794 21.6017 115.164 20.003 115.905 18.6267C116.646 17.2504 117.684 16.1917 119.018 15.4506C120.352 14.7095 121.887 14.3389 123.623 14.3389C125.296 14.3389 126.789 14.6989 128.102 15.4188C129.436 16.1387 130.462 17.1657 131.182 18.4996C131.924 19.8124 132.294 21.3264 132.294 23.0415ZM127.689 21.771C127.668 20.6276 127.255 19.7172 126.45 19.0396C125.645 18.3408 124.661 17.9915 123.496 17.9915C122.395 17.9915 121.464 18.3303 120.701 19.0078C119.96 19.6642 119.505 20.5853 119.336 21.771H127.689ZM141.955 32.5063C140.516 32.5063 139.224 32.2522 138.081 31.744C136.937 31.2147 136.027 30.5054 135.349 29.616C134.693 28.7267 134.333 27.7421 134.269 26.6623H138.748C138.832 27.3398 139.16 27.9009 139.732 28.3456C140.325 28.7903 141.055 29.0126 141.924 29.0126C142.771 29.0126 143.427 28.8432 143.893 28.5044C144.38 28.1656 144.623 27.7316 144.623 27.2022C144.623 26.6305 144.327 26.207 143.734 25.9318C143.162 25.6353 142.241 25.3177 140.971
{ "end_byte": 5628, "start_byte": 2208, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg_5629_6611
24.9789C139.658 24.6613 138.578 24.3331 137.731 23.9943C136.905 23.6555 136.185 23.1368 135.571 22.438C134.979 21.7393 134.682 20.797 134.682 19.6113C134.682 18.6373 134.957 17.748 135.508 16.9434C136.08 16.1387 136.884 15.5035 137.922 15.0377C138.98 14.5719 140.219 14.3389 141.638 14.3389C143.734 14.3389 145.407 14.8683 146.656 15.927C147.905 16.9645 148.593 18.3726 148.721 20.1512H144.465C144.401 19.4525 144.105 18.902 143.575 18.4996C143.067 18.0762 142.379 17.8644 141.511 17.8644C140.706 17.8644 140.081 18.0126 139.637 18.3091C139.213 18.6055 139.002 19.0184 139.002 19.5478C139.002 20.1406 139.298 20.5959 139.891 20.9135C140.484 21.2099 141.405 21.517 142.654 21.8346C143.925 22.1522 144.973 22.4804 145.798 22.8192C146.624 23.1579 147.334 23.6873 147.926 24.4072C148.541 25.106 148.858 26.0376 148.879 27.2022C148.879 28.2186 148.593 29.129 148.022 29.9337C147.471 30.7383 146.667 31.3735 145.608 31.8393C144.57 32.284 143.353 32.5063 141.955 32.5063Z" fill="#605DC8"/>
{ "end_byte": 6611, "start_byte": 5629, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg_6612_6619
</svg>
{ "end_byte": 6619, "start_byte": 6612, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/13-search/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/README.md_0_4824
# Add routes to the application This tutorial lesson demonstrates how to add routes to your app. <docs-video src="https://www.youtube.com/embed/r5DEBMuStPw?si=H6Bx6nLJoMLaMxkx" /> IMPORTANT: We recommend using your local environment to learn routing. ## What you'll learn At the end of this lesson your application will have support for routing. ## Conceptual preview of routing This tutorial introduces routing in Angular. Routing is the ability to navigate from one component in the application to another. In [Single Page Applications (SPA)](guide/routing), only parts of the page are updated to represent the requested view for the user. The [Angular Router](guide/routing) enables users to declare routes and specify which component should be displayed on the screen if that route is requested by the application. In this lesson, you will enable routing in your application to navigate to the details page. <docs-workflow> <docs-step title="Create a default details component "> 1. From the terminal, enter the following command to create the `DetailsComponent`: <docs-code language="shell"> ng generate component details </docs-code> This component will represent the details page that provides more information on a given housing location. </docs-step> <docs-step title="Add routing to the application"> 1. In the `src/app` directory, create a file called `routes.ts`. This file is where we will define the routes in the application. 1. In `main.ts`, make the following updates to enable routing in the application: 1. Import the routes file and the `provideRouter` function: <docs-code header="Import routing details in src/main.ts" path="adev/src/content/tutorials/first-app/steps/11-details-page/src/main.ts" visibleLines="[7,8]"/> 1. Update the call to `bootstrapApplication` to include the routing configuration: <docs-code header="Add router configuration in src/main.ts" path="adev/src/content/tutorials/first-app/steps/11-details-page/src/main.ts" visibleLines="[10,17]"/> 1. In `src/app/app.component.ts`, update the component to use routing: 1. Add a file level import for `RoutingModule`: <docs-code header="Import RouterModule in src/app/app.component.ts" path="adev/src/content/tutorials/first-app/steps/11-details-page/src/app/app.component.ts" visibleLines="[3]"/> 1. Add `RouterModule` to the `@Component` metadata imports <docs-code header="Import RouterModule in src/app/app.component.ts" path="adev/src/content/tutorials/first-app/steps/11-details-page/src/app/app.component.ts" visibleLines="[7]"/> 1. In the `template` property, replace the `<app-home></app-home>` tag with the `<router-outlet>` directive and add a link back to the home page. Your code should match this code: <docs-code header="Add router-outlet in src/app/app.component.ts" path="adev/src/content/tutorials/first-app/steps/11-details-page/src/app/app.component.ts" visibleLines="[8,18]"/> </docs-step> <docs-step title="Add route to new component"> In the previous step you removed the reference to the `<app-home>` component in the template. In this step, you will add a new route to that component. 1. In `routes.ts`, perform the following updates to create a route. 1. Add a file level imports for the `HomeComponent`, `DetailsComponent` and the `Routes` type that you'll use in the route definitions. <docs-code header="Import components and Routes" path="adev/src/content/tutorials/first-app/steps/11-details-page/src/app/routes.ts" visibleLines="[1,3]"/> 1. Define a variable called `routeConfig` of type `Routes` and define two routes for the app: <docs-code header="Add routes to the app" path="adev/src/content/tutorials/first-app/steps/11-details-page/src/app/routes.ts" visibleLines="[5,18]"/> The entries in the `routeConfig` array represent the routes in the application. The first entry navigates to the `HomeComponent` whenever the url matches `''`. The second entry uses some special formatting that will be revisited in a future lesson. 1. Save all changes and confirm that the application works in the browser. The application should still display the list of housing locations. </docs-step> </docs-workflow> Summary: In this lesson, you enabled routing in your app as well as defined new routes. Now your app can support navigation between views. In the next lesson, you will learn to navigate to the "details" page for a given housing location. You are making great progress with your app, well done. For more information about the topics covered in this lesson, visit: <docs-pill-row> <docs-pill href="guide/routing" title="Routing in Angular Overview"/> <docs-pill href="guide/routing/common-router-tasks" title="Common Routing Tasks"/> </docs-pill-row>
{ "end_byte": 4824, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/README.md" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/index.html_0_427
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Homes</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 427, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/index.html" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/main.ts_0_420
/* * Protractor support is deprecated in Angular. * Protractor is used in this example for compatibility with Angular documentation tools. */ import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, {providers: [provideProtractorTestingSupport()]}).catch((err) => console.error(err), );
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/main.ts" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/styles.css_0_443
/* You can add global styles to this file, and also import other style files */ * { margin: 0; padding: 0; } body { font-family: 'Be Vietnam Pro', sans-serif; } :root { --primary-color: #605DC8; --secondary-color: #8B89E6; --accent-color: #e8e7fa; --shadow-color: #E8E8E8; } button.primary { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; }
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/styles.css" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housinglocation.ts_0_180
export interface HousingLocation { id: number; name: string; city: string; state: string; photo: string; availableUnits: number; wifi: boolean; laundry: boolean; }
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housinglocation.ts" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing.service.ts_0_2977
import {Injectable} from '@angular/core'; import {HousingLocation} from './housinglocation'; @Injectable({ providedIn: 'root', }) export class HousingService { readonly baseUrl = 'https://angular.dev/assets/images/tutorials/common'; protected housingLocationList: HousingLocation[] = [ { id: 0, name: 'Acme Fresh Start Housing', city: 'Chicago', state: 'IL', photo: `${this.baseUrl}/bernard-hermant-CLKGGwIBTaY-unsplash.jpg`, availableUnits: 4, wifi: true, laundry: true, }, { id: 1, name: 'A113 Transitional Housing', city: 'Santa Monica', state: 'CA', photo: `${this.baseUrl}/brandon-griggs-wR11KBaB86U-unsplash.jpg`, availableUnits: 0, wifi: false, laundry: true, }, { id: 2, name: 'Warm Beds Housing Support', city: 'Juneau', state: 'AK', photo: `${this.baseUrl}/i-do-nothing-but-love-lAyXdl1-Wmc-unsplash.jpg`, availableUnits: 1, wifi: false, laundry: false, }, { id: 3, name: 'Homesteady Housing', city: 'Chicago', state: 'IL', photo: `${this.baseUrl}/ian-macdonald-W8z6aiwfi1E-unsplash.jpg`, availableUnits: 1, wifi: true, laundry: false, }, { id: 4, name: 'Happy Homes Group', city: 'Gary', state: 'IN', photo: `${this.baseUrl}/krzysztof-hepner-978RAXoXnH4-unsplash.jpg`, availableUnits: 1, wifi: true, laundry: false, }, { id: 5, name: 'Hopeful Apartment Group', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/r-architecture-JvQ0Q5IkeMM-unsplash.jpg`, availableUnits: 2, wifi: true, laundry: true, }, { id: 6, name: 'Seriously Safe Towns', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/phil-hearing-IYfp2Ixe9nM-unsplash.jpg`, availableUnits: 5, wifi: true, laundry: true, }, { id: 7, name: 'Hopeful Housing Solutions', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/r-architecture-GGupkreKwxA-unsplash.jpg`, availableUnits: 2, wifi: true, laundry: true, }, { id: 8, name: 'Seriously Safe Towns', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/saru-robert-9rP3mxf8qWI-unsplash.jpg`, availableUnits: 10, wifi: false, laundry: false, }, { id: 9, name: 'Capital Safe Towns', city: 'Portland', state: 'OR', photo: `${this.baseUrl}/webaliser-_TPTXZd9mOo-unsplash.jpg`, availableUnits: 6, wifi: true, laundry: true, }, ]; getAllHousingLocations(): HousingLocation[] { return this.housingLocationList; } getHousingLocationById(id: number): HousingLocation | undefined { return this.housingLocationList.find((housingLocation) => housingLocation.id === id); } }
{ "end_byte": 2977, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing.service.ts" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/app.component.ts_0_529
import {Component} from '@angular/core'; import {HomeComponent} from './home/home.component'; @Component({ selector: 'app-root', standalone: true, imports: [HomeComponent], template: ` <main> <header class="brand-name"> <img class="brand-logo" src="/assets/logo.svg" alt="logo" aria-hidden="true" /> </header> <section class="content"> <app-home></app-home> </section> </main> `, styleUrls: ['./app.component.css'], }) export class AppComponent { title = 'homes'; }
{ "end_byte": 529, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/app.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/app.component.css_0_213
:host { --content-padding: 10px; } header { display: block; height: 60px; padding: var(--content-padding); box-shadow: 0px 5px 25px var(--shadow-color); } .content { padding: var(--content-padding); }
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/app.component.css" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.component.ts_0_1080
import {Component, inject} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocationComponent} from '../housing-location/housing-location.component'; import {HousingLocation} from '../housinglocation'; import {HousingService} from '../housing.service'; @Component({ selector: 'app-home', standalone: true, imports: [CommonModule, HousingLocationComponent], template: ` <section> <form> <input type="text" placeholder="Filter by city" /> <button class="primary" type="button">Search</button> </form> </section> <section class="results"> <app-housing-location *ngFor="let housingLocation of housingLocationList" [housingLocation]="housingLocation" ></app-housing-location> </section> `, styleUrls: ['./home.component.css'], }) export class HomeComponent { housingLocationList: HousingLocation[] = []; housingService: HousingService = inject(HousingService); constructor() { this.housingLocationList = this.housingService.getAllHousingLocations(); } }
{ "end_byte": 1080, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.component.css_0_746
.results { display: grid; column-gap: 14px; row-gap: 14px; grid-template-columns: repeat(auto-fill, minmax(400px, 400px)); margin-top: 50px; justify-content: space-around; } input[type="text"] { border: solid 1px var(--primary-color); padding: 10px; border-radius: 8px; margin-right: 4px; display: inline-block; width: 30%; } button { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; } @media (min-width: 500px) and (max-width: 768px) { .results { grid-template-columns: repeat(2, 1fr); } input[type="text"] { width: 70%; } } @media (max-width: 499px) { .results { grid-template-columns: 1fr; } }
{ "end_byte": 746, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/home/home.component.css" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing-location/housing-location.component.css_0_583
.listing { background: var(--accent-color); border-radius: 30px; padding-bottom: 30px; } .listing-heading { color: var(--primary-color); padding: 10px 20px 0 20px; } .listing-photo { height: 250px; width: 100%; object-fit: cover; border-radius: 30px 30px 0 0; } .listing-location { padding: 10px 20px 20px 20px; } .listing-location::before { content: url("/assets/location-pin.svg") / ""; } section.listing a { padding-left: 20px; text-decoration: none; color: var(--primary-color); } section.listing a::after { content: "\203A"; margin-left: 5px; }
{ "end_byte": 583, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing-location/housing-location.component.css" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing-location/housing-location.component.ts_0_776
import {Component, Input} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocation} from '../housinglocation'; @Component({ selector: 'app-housing-location', standalone: true, imports: [CommonModule], template: ` <section class="listing"> <img class="listing-photo" [src]="housingLocation.photo" alt="Exterior photo of {{ housingLocation.name }}" crossorigin /> <h2 class="listing-heading">{{ housingLocation.name }}</h2> <p class="listing-location">{{ housingLocation.city }}, {{ housingLocation.state }}</p> </section> `, styleUrls: ['./housing-location.component.css'], }) export class HousingLocationComponent { @Input() housingLocation!: HousingLocation; }
{ "end_byte": 776, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/app/housing-location/housing-location.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/location-pin.svg_0_502
<?xml version="1.0" encoding="UTF-8"?> <svg width="20pt" height="20pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 11.602c-15.398 0-27.898 12.5-27.898 27.898 0 5 1.3008 9.6992 3.6016 13.801l2.8984 4.1992 21.398 30.898 21.801-31.398 2.1992-3.1992c2.5-4.1992 3.8984-9 3.8984-14.199 0-15.5-12.5-28-27.898-28zm0 35.598c-4.1992 0-7.6992-3.3984-7.6992-7.6992s3.3984-7.6992 7.6992-7.6992 7.6992 3.3984 7.6992 7.6992-3.5 7.6992-7.6992 7.6992z" fill="#605cc8"/> </svg>
{ "end_byte": 502, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/location-pin.svg" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg_0_2207
<svg width="151" height="44" viewBox="0 0 151 44" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M6.15532 33.2946C5.25369 33.2946 4.58006 32.5707 4.58006 31.6701V24.0152C4.58006 19.5469 4.35206 20.6276 7.59585 17.4236C21.7317 4.06732 16.2425 4.24744 29.6149 18.054C32.0434 20.7627 31.9985 19.4534 31.9985 23.8316V31.6667C31.9985 32.5707 31.28 33.2912 30.3749 33.2912H6.15532V33.2946Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M30.896 35.1547L5.73676 35.2586C4.80059 35.2621 3.75042 35.8232 3.37388 36.5229L2.90061 37.4027L0.537726 41.7878L0.140457 42.529C-0.236085 43.2253 0.164639 43.7829 1.10081 43.7795L26.26 43.6756C27.1962 43.6721 28.2464 43.111 28.6229 42.4113L29.0962 41.5315L31.4591 37.1463L31.8563 36.4051C32.2329 35.7089 31.8321 35.1512 30.896 35.1547Z" fill="#605DC8"/> <path d="M2.54861 18.7156C2.23079 18.7156 1.90952 18.629 1.6228 18.4454C0.821352 17.9363 0.5899 16.859 1.09771 16.0554C1.46389 15.4701 2.70061 14.2231 5.50912 11.4659L6.39693 10.5931C8.73218 8.38318 10.5147 6.56817 11.9449 5.10646C15.1679 1.81587 16.7985 0.153263 18.9023 0.222538C20.9888 0.277958 22.4362 1.92325 25.3138 5.19651C26.7267 6.8037 28.4816 8.8023 30.8514 11.2477C30.8652 11.265 30.8825 11.2789 30.8963 11.2962C31.228 11.6634 31.715 12.2003 32.2401 12.7752C33.9743 14.6734 34.8206 15.6086 35.0763 15.9688C35.629 16.7413 35.4494 17.8185 34.679 18.3727C33.9087 18.9234 32.8343 18.7468 32.2816 17.9744C32.0639 17.6869 30.5889 16.0693 29.708 15.1064C29.1863 14.5348 28.6993 14.0014 28.3642 13.6308C25.9495 11.1369 24.1704 9.11057 22.7368 7.4826C21.0233 5.5325 19.4032 3.68977 18.809 3.67245H18.8021C18.1699 3.67245 16.3356 5.54289 14.3976 7.52417C12.9467 9.00666 11.14 10.8494 8.78054 13.0766L7.91001 13.9321C6.74929 15.0717 4.33804 17.4375 3.97877 17.9293C3.65405 18.4454 3.10824 18.7225 2.54515 18.7225L2.54861 18.7156Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M22.0976 33.2115V26.0588C22.0976 25.4665 21.6174 24.985 21.0267 24.985H15.1955C14.6047 24.985 14.1246 25.4665 14.1246 26.0588V33.2115C14.1246 33.2704 14.1142 33.3293 14.0969 33.3847H22.1252C22.1079 33.3293 22.0976 33.2739 22.0976 33.2115Z" fill="white"/>
{ "end_byte": 2207, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg_2208_5628
<path d="M58.9784 10.0512V32.2205H54.5319V22.7874H45.0353V32.2205H40.5887V10.0512H45.0353V19.1666H54.5319V10.0512H58.9784ZM70.8506 32.5063C69.1567 32.5063 67.6322 32.1358 66.277 31.3947C64.9219 30.6324 63.8526 29.5631 63.0692 28.1868C62.3069 26.8105 61.9258 25.2224 61.9258 23.4226C61.9258 21.6228 62.3175 20.0348 63.1009 18.6585C63.9055 17.2821 64.996 16.2234 66.3723 15.4823C67.7486 14.7201 69.2838 14.3389 70.9777 14.3389C72.6716 14.3389 74.2067 14.7201 75.5831 15.4823C76.9594 16.2234 78.0393 17.2821 78.8227 18.6585C79.6273 20.0348 80.0296 21.6228 80.0296 23.4226C80.0296 25.2224 79.6167 26.8105 78.7909 28.1868C77.9863 29.5631 76.8853 30.6324 75.4878 31.3947C74.1115 32.1358 72.5657 32.5063 70.8506 32.5063ZM70.8506 28.6315C71.6553 28.6315 72.4069 28.4409 73.1057 28.0597C73.8256 27.6574 74.3973 27.0646 74.8208 26.2811C75.2443 25.4977 75.456 24.5449 75.456 23.4226C75.456 21.7499 75.0114 20.4688 74.122 19.5795C73.2539 18.669 72.1846 18.2138 70.9142 18.2138C69.6437 18.2138 68.5744 18.669 67.7063 19.5795C66.8593 20.4688 66.4358 21.7499 66.4358 23.4226C66.4358 25.0954 66.8487 26.387 67.6745 27.2975C68.5215 28.1868 69.5802 28.6315 70.8506 28.6315ZM104.825 14.3707C106.985 14.3707 108.721 15.0377 110.034 16.3717C111.368 17.6844 112.035 19.5266 112.035 21.8981V32.2205H107.589V22.5016C107.589 21.1252 107.239 20.0771 106.54 19.3572C105.842 18.6161 104.889 18.2456 103.682 18.2456C102.475 18.2456 101.512 18.6161 100.792 19.3572C100.093 20.0771 99.7436 21.1252 99.7436 22.5016V32.2205H95.297V22.5016C95.297 21.1252 94.9477 20.0771 94.2489 19.3572C93.5502 18.6161 92.5974 18.2456 91.3904 18.2456C90.1623 18.2456 89.1883 18.6161 88.4684 19.3572C87.7697 20.0771 87.4203 21.1252 87.4203 22.5016V32.2205H82.9737V14.6248H87.4203V16.7528C87.992 16.0117 88.7225 15.4294 89.6118 15.0059C90.5223 14.5824 91.5175 14.3707 92.5974 14.3707C93.9737 14.3707 95.2018 14.6671 96.2816 15.26C97.3615 15.8317 98.1979 16.6575 98.7908 17.7374C99.3625 16.721 100.188 15.9058 101.268 15.2918C102.369 14.6777 103.555 14.3707 104.825 14.3707ZM132.294 23.0415C132.294 23.6767 132.252 24.2484 132.167 24.7566H119.304C119.41 26.027 119.854 27.0222 120.638 27.7421C121.421 28.4621 122.385 28.822 123.528 28.822C125.18 28.822 126.355 28.1127 127.053 26.694H131.849C131.341 28.3879 130.367 29.7854 128.927 30.8865C127.488 31.9664 125.72 32.5063 123.623 32.5063C121.929 32.5063 120.405 32.1358 119.05 31.3947C117.716 30.6324 116.668 29.5631 115.905 28.1868C115.164 26.8105 114.794 25.2224 114.794 23.4226C114.794 21.6017 115.164 20.003 115.905 18.6267C116.646 17.2504 117.684 16.1917 119.018 15.4506C120.352 14.7095 121.887 14.3389 123.623 14.3389C125.296 14.3389 126.789 14.6989 128.102 15.4188C129.436 16.1387 130.462 17.1657 131.182 18.4996C131.924 19.8124 132.294 21.3264 132.294 23.0415ZM127.689 21.771C127.668 20.6276 127.255 19.7172 126.45 19.0396C125.645 18.3408 124.661 17.9915 123.496 17.9915C122.395 17.9915 121.464 18.3303 120.701 19.0078C119.96 19.6642 119.505 20.5853 119.336 21.771H127.689ZM141.955 32.5063C140.516 32.5063 139.224 32.2522 138.081 31.744C136.937 31.2147 136.027 30.5054 135.349 29.616C134.693 28.7267 134.333 27.7421 134.269 26.6623H138.748C138.832 27.3398 139.16 27.9009 139.732 28.3456C140.325 28.7903 141.055 29.0126 141.924 29.0126C142.771 29.0126 143.427 28.8432 143.893 28.5044C144.38 28.1656 144.623 27.7316 144.623 27.2022C144.623 26.6305 144.327 26.207 143.734 25.9318C143.162 25.6353 142.241 25.3177 140.971
{ "end_byte": 5628, "start_byte": 2208, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg_5629_6611
24.9789C139.658 24.6613 138.578 24.3331 137.731 23.9943C136.905 23.6555 136.185 23.1368 135.571 22.438C134.979 21.7393 134.682 20.797 134.682 19.6113C134.682 18.6373 134.957 17.748 135.508 16.9434C136.08 16.1387 136.884 15.5035 137.922 15.0377C138.98 14.5719 140.219 14.3389 141.638 14.3389C143.734 14.3389 145.407 14.8683 146.656 15.927C147.905 16.9645 148.593 18.3726 148.721 20.1512H144.465C144.401 19.4525 144.105 18.902 143.575 18.4996C143.067 18.0762 142.379 17.8644 141.511 17.8644C140.706 17.8644 140.081 18.0126 139.637 18.3091C139.213 18.6055 139.002 19.0184 139.002 19.5478C139.002 20.1406 139.298 20.5959 139.891 20.9135C140.484 21.2099 141.405 21.517 142.654 21.8346C143.925 22.1522 144.973 22.4804 145.798 22.8192C146.624 23.1579 147.334 23.6873 147.926 24.4072C148.541 25.106 148.858 26.0376 148.879 27.2022C148.879 28.2186 148.593 29.129 148.022 29.9337C147.471 30.7383 146.667 31.3735 145.608 31.8393C144.57 32.284 143.353 32.5063 141.955 32.5063Z" fill="#605DC8"/>
{ "end_byte": 6611, "start_byte": 5629, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg_6612_6619
</svg>
{ "end_byte": 6619, "start_byte": 6612, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/10-routing/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/README.md_0_7579
# Integrate details page into application This tutorial lesson demonstrates how to connect the details page to your app. <docs-video src="https://www.youtube.com/embed/-jRxG84AzCI?si=CbqIpmRpwp5ZZDnu&amp;start=345"/> IMPORTANT: We recommend using your local environment to learn routing. ## What you'll learn At the end of this lesson your application will have support for routing to the details page. ## Conceptual preview of routing with route parameters Each housing location has specific details that should be displayed when a user navigates to the details page for that item. To accomplish this goal, you will need to use route parameters. Route parameters enable you to include dynamic information as a part of your route URL. To identify which housing location a user has clicked on you will use the `id` property of the `HousingLocation` type. <docs-workflow> <docs-step title="Using `routerLink` for dynamic navigation"> In lesson 10, you added a second route to `src/app/routes.ts` which includes a special segment that identifies the route parameter, `id`: <docs-code language="javascript"> 'details/:id' </docs-code> In this case, `:id` is dynamic and will change based on how the route is requested by the code. 1. In `src/app/housing-location/housing-location.component.ts`, add an anchor tag to the `section` element and include the `routerLink` directive: <docs-code header="Add anchor with a routerLink directive to housing-location.component.ts" path="adev/src/content/tutorials/first-app/steps/12-forms/src/app/housing-location/housing-location.component.ts" visibleLines="[20]"/> The `routerLink` directive enables Angular's router to create dynamic links in the application. The value assigned to the `routerLink` is an array with two entries: the static portion of the path and the dynamic data. For the `routerLink` to work in the template, add a file level import of `RouterLink` and `RouterOutlet` from '@angular/router', then update the component `imports` array to include both `RouterLink` and `RouterOutlet`. 1. At this point you can confirm that the routing is working in your app. In the browser, refresh the home page and click the "Learn More" button for a housing location. <img alt="details page displaying the text 'details works!'" src="assets/images/tutorials/first-app/homes-app-lesson-11-step-1.png"> </docs-step> <docs-step title="Get route parameters"> In this step, you will get the route parameter in the `DetailsComponent`. Currently, the app displays `details works!`. Next you'll update the code to display the `id` value passed using the route parameters. 1. In `src/app/details/details.component.ts` update the template to import the functions, classes and services that you'll need to use in the `DetailsComponent`: <docs-code header="Update file level imports" path="adev/src/content/tutorials/first-app/steps/12-forms/src/app/details/details.component.ts" visibleLines="[1,5]"/> 1. Update the `template` property of the `@Component` decorator to display the value `housingLocationId`: <docs-code language="javascript"> template: `<p>details works! {{ housingLocationId }}</p>`, </docs-code> 1. Update the body of the `DetailsComponent` class with the following code: <docs-code language="javascript"> export class DetailsComponent { route: ActivatedRoute = inject(ActivatedRoute); housingLocationId = -1; constructor() { this.housingLocationId = Number(this.route.snapshot.params['id']); } } </docs-code> This code gives the `DetailsComponent` access to the `ActivatedRoute` router feature that enables you to have access to the data about the current route. In the `constructor`, the code converts the `id` parameter acquired from the route from a string to a number. 1. Save all changes. 1. In the browser, click on one of the housing location's "Learn More" links and confirm that the numeric value displayed on the page matches the `id` property for that location in the data. </docs-step> <docs-step title="Customize the `DetailComponent`"> Now that routing is working properly in the application this is a great time to update the template of the `DetailsComponent` to display the specific data represented by the housing location for the route parameter. To access the data you will add a call to the `HousingService`. 1. Update the template code to match the following code: <docs-code header="Update the DetailsComponent template in src/app/details/details.component.ts" path="adev/src/content/tutorials/first-app/steps/12-forms/src/app/details/details.component.ts" visibleLines="[11,32]"/> Notice that the `housingLocation` properties are being accessed with the optional chaining operator `?`. This ensures that if the `housingLocation` value is null or undefined the application doesn't crash. 1. Update the body of the `DetailsComponent` class to match the following code: <docs-code header="Update the DetailsComponent class in src/app/details/details.component.ts" path="adev/src/content/tutorials/first-app/steps/12-forms/src/app/details/details.component.ts" visibleLines="[35,44]"/> Now the component has the code to display the correct information based on the selected housing location. The `constructor` now includes a call to the `HousingService` to pass the route parameter as an argument to the `getHousingLocationById` service function. 1. Copy the following styles into the `src/app/details/details.component.css` file: <docs-code header="Add styles for the DetailsComponent" path="adev/src/content/tutorials/first-app/steps/12-forms/src/app/details/details.component.css" visibleLines="[1,71]"/> 1. Save your changes. 1. In the browser refresh the page and confirm that when you click on the "Learn More" link for a given housing location the details page displays the correct information based on the data for that selected item. <img alt="Details page listing home info" src="assets/images/tutorials/first-app/homes-app-lesson-11-step-3.png"> </docs-step> <docs-step title="Add navigation to the `HomeComponent`"> In a previous lesson you updated the `AppComponent` template to include a `routerLink`. Adding that code updated your app to enable navigation back to the `HomeComponent` whenever the logo is clicked. 1. Confirm that your code matches the following: <docs-code header="Add routerLink to AppComponent" path="adev/src/content/tutorials/first-app/steps/12-forms/src/app/app.component.ts" visibleLines="[8,20]"/> Your code may already be up-to-date but confirm to be sure. </docs-step> </docs-workflow> Summary: In this lesson you added routing to show details pages. You now know how to: * use route parameters to pass data to a route * use the `routerLink` directive to use dynamic data to create a route * use route parameter to retrieve data from the `HousingService` to display specific housing location information. Really great work so far. For more information about the topics covered in this lesson, visit: <docs-pill-row> <docs-pill href="guide/routing/common-router-tasks#accessing-query-parameters-and-fragments" title="Route Parameters"/> <docs-pill href="guide/routing" title="Routing in Angular Overview"/> <docs-pill href="guide/routing/common-router-tasks" title="Common Routing Tasks"/> <docs-pill href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/Optional_chaining" title="Optional Chaining Operator"/> </docs-pill-row>
{ "end_byte": 7579, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/README.md" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/index.html_0_427
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Homes</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 427, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/index.html" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/main.ts_0_536
/* * Protractor support is deprecated in Angular. * Protractor is used in this example for compatibility with Angular documentation tools. */ import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; import {provideRouter} from '@angular/router'; import routeConfig from './app/routes'; bootstrapApplication(AppComponent, { providers: [provideProtractorTestingSupport(), provideRouter(routeConfig)], }).catch((err) => console.error(err));
{ "end_byte": 536, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/main.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/styles.css_0_443
/* You can add global styles to this file, and also import other style files */ * { margin: 0; padding: 0; } body { font-family: 'Be Vietnam Pro', sans-serif; } :root { --primary-color: #605DC8; --secondary-color: #8B89E6; --accent-color: #e8e7fa; --shadow-color: #E8E8E8; } button.primary { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; }
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/styles.css" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/routes.ts_0_389
import {Routes} from '@angular/router'; import {HomeComponent} from './home/home.component'; import {DetailsComponent} from './details/details.component'; const routeConfig: Routes = [ { path: '', component: HomeComponent, title: 'Home page', }, { path: 'details/:id', component: DetailsComponent, title: 'Home details', }, ]; export default routeConfig;
{ "end_byte": 389, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/routes.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housinglocation.ts_0_180
export interface HousingLocation { id: number; name: string; city: string; state: string; photo: string; availableUnits: number; wifi: boolean; laundry: boolean; }
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housinglocation.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housing.service.ts_0_2978
import {Injectable} from '@angular/core'; import {HousingLocation} from './housinglocation'; @Injectable({ providedIn: 'root', }) export class HousingService { readonly baseUrl = 'https://angular.dev/assets/images/tutorials/common'; protected housingLocationList: HousingLocation[] = [ { id: 0, name: 'Acme Fresh Start Housing', city: 'Chicago', state: 'IL', photo: `${this.baseUrl}/bernard-hermant-CLKGGwIBTaY-unsplash.jpg`, availableUnits: 4, wifi: true, laundry: true, }, { id: 1, name: 'A113 Transitional Housing', city: 'Santa Monica', state: 'CA', photo: `${this.baseUrl}/brandon-griggs-wR11KBaB86U-unsplash.jpg`, availableUnits: 0, wifi: false, laundry: true, }, { id: 2, name: 'Warm Beds Housing Support', city: 'Juneau', state: 'AK', photo: `${this.baseUrl}/i-do-nothing-but-love-lAyXdl1-Wmc-unsplash.jpg`, availableUnits: 1, wifi: false, laundry: false, }, { id: 3, name: 'Homesteady Housing', city: 'Chicago', state: 'IL', photo: `${this.baseUrl}/ian-macdonald-W8z6aiwfi1E-unsplash.jpg`, availableUnits: 1, wifi: true, laundry: false, }, { id: 4, name: 'Happy Homes Group', city: 'Gary', state: 'IN', photo: `${this.baseUrl}/krzysztof-hepner-978RAXoXnH4-unsplash.jpg`, availableUnits: 1, wifi: true, laundry: false, }, { id: 5, name: 'Hopeful Apartment Group', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/r-architecture-JvQ0Q5IkeMM-unsplash.jpg`, availableUnits: 2, wifi: true, laundry: true, }, { id: 6, name: 'Seriously Safe Towns', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/phil-hearing-IYfp2Ixe9nM-unsplash.jpg`, availableUnits: 5, wifi: true, laundry: true, }, { id: 7, name: 'Hopeful Housing Solutions', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/r-architecture-GGupkreKwxA-unsplash.jpg`, availableUnits: 2, wifi: true, laundry: true, }, { id: 8, name: 'Seriously Safe Towns', city: 'Oakland', state: 'CA', photo: `${this.baseUrl}/saru-robert-9rP3mxf8qWI-unsplash.jpg`, availableUnits: 10, wifi: false, laundry: false, }, { id: 9, name: 'Capital Safe Towns', city: 'Portland', state: 'OR', photo: `${this.baseUrl}/webaliser-_TPTXZd9mOo-unsplash.jpg`, availableUnits: 6, wifi: true, laundry: true, }, ]; getAllHousingLocations(): HousingLocation[] { return this.housingLocationList; } getHousingLocationById(id: number): HousingLocation | undefined { return this.housingLocationList.find((housingLocation) => housingLocation.id === id); } }
{ "end_byte": 2978, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housing.service.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/app.component.ts_0_646
import {Component} from '@angular/core'; import {HomeComponent} from './home/home.component'; import {RouterModule} from '@angular/router'; @Component({ selector: 'app-root', standalone: true, imports: [HomeComponent, RouterModule], template: ` <main> <a [routerLink]="['/']"> <header class="brand-name"> <img class="brand-logo" src="/assets/logo.svg" alt="logo" aria-hidden="true" /> </header> </a> <section class="content"> <router-outlet></router-outlet> </section> </main> `, styleUrls: ['./app.component.css'], }) export class AppComponent { title = 'homes'; }
{ "end_byte": 646, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/app.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/app.component.css_0_213
:host { --content-padding: 10px; } header { display: block; height: 60px; padding: var(--content-padding); box-shadow: 0px 5px 25px var(--shadow-color); } .content { padding: var(--content-padding); }
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/app.component.css" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/home/home.component.ts_0_1081
import {Component, inject} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocationComponent} from '../housing-location/housing-location.component'; import {HousingLocation} from '../housinglocation'; import {HousingService} from '../housing.service'; @Component({ selector: 'app-home', standalone: true, imports: [CommonModule, HousingLocationComponent], template: ` <section> <form> <input type="text" placeholder="Filter by city" /> <button class="primary" type="button">Search</button> </form> </section> <section class="results"> <app-housing-location *ngFor="let housingLocation of housingLocationList" [housingLocation]="housingLocation" ></app-housing-location> </section> `, styleUrls: ['./home.component.css'], }) export class HomeComponent { housingLocationList: HousingLocation[] = []; housingService: HousingService = inject(HousingService); constructor() { this.housingLocationList = this.housingService.getAllHousingLocations(); } }
{ "end_byte": 1081, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/home/home.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/home/home.component.css_0_746
.results { display: grid; column-gap: 14px; row-gap: 14px; grid-template-columns: repeat(auto-fill, minmax(400px, 400px)); margin-top: 50px; justify-content: space-around; } input[type="text"] { border: solid 1px var(--primary-color); padding: 10px; border-radius: 8px; margin-right: 4px; display: inline-block; width: 30%; } button { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; } @media (min-width: 500px) and (max-width: 768px) { .results { grid-template-columns: repeat(2, 1fr); } input[type="text"] { width: 70%; } } @media (max-width: 499px) { .results { grid-template-columns: 1fr; } }
{ "end_byte": 746, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/home/home.component.css" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housing-location/housing-location.component.css_0_583
.listing { background: var(--accent-color); border-radius: 30px; padding-bottom: 30px; } .listing-heading { color: var(--primary-color); padding: 10px 20px 0 20px; } .listing-photo { height: 250px; width: 100%; object-fit: cover; border-radius: 30px 30px 0 0; } .listing-location { padding: 10px 20px 20px 20px; } .listing-location::before { content: url("/assets/location-pin.svg") / ""; } section.listing a { padding-left: 20px; text-decoration: none; color: var(--primary-color); } section.listing a::after { content: "\203A"; margin-left: 5px; }
{ "end_byte": 583, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housing-location/housing-location.component.css" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housing-location/housing-location.component.ts_0_836
import {Component, Input} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocation} from '../housinglocation'; import {RouterModule} from '@angular/router'; @Component({ selector: 'app-housing-location', standalone: true, imports: [CommonModule, RouterModule], template: ` <section class="listing"> <img class="listing-photo" [src]="housingLocation.photo" alt="Exterior photo of {{ housingLocation.name }}" crossorigin /> <h2 class="listing-heading">{{ housingLocation.name }}</h2> <p class="listing-location">{{ housingLocation.city }}, {{ housingLocation.state }}</p> </section> `, styleUrls: ['./housing-location.component.css'], }) export class HousingLocationComponent { @Input() housingLocation!: HousingLocation; }
{ "end_byte": 836, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/housing-location/housing-location.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/details/details.component.ts_0_298
import {Component} from '@angular/core'; import {CommonModule} from '@angular/common'; @Component({ selector: 'app-details', standalone: true, imports: [CommonModule], template: ` <p>details works!</p> `, styleUrls: ['./details.component.css'], }) export class DetailsComponent {}
{ "end_byte": 298, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/app/details/details.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/location-pin.svg_0_502
<?xml version="1.0" encoding="UTF-8"?> <svg width="20pt" height="20pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 11.602c-15.398 0-27.898 12.5-27.898 27.898 0 5 1.3008 9.6992 3.6016 13.801l2.8984 4.1992 21.398 30.898 21.801-31.398 2.1992-3.1992c2.5-4.1992 3.8984-9 3.8984-14.199 0-15.5-12.5-28-27.898-28zm0 35.598c-4.1992 0-7.6992-3.3984-7.6992-7.6992s3.3984-7.6992 7.6992-7.6992 7.6992 3.3984 7.6992 7.6992-3.5 7.6992-7.6992 7.6992z" fill="#605cc8"/> </svg>
{ "end_byte": 502, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/location-pin.svg" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg_0_2207
<svg width="151" height="44" viewBox="0 0 151 44" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M6.15532 33.2946C5.25369 33.2946 4.58006 32.5707 4.58006 31.6701V24.0152C4.58006 19.5469 4.35206 20.6276 7.59585 17.4236C21.7317 4.06732 16.2425 4.24744 29.6149 18.054C32.0434 20.7627 31.9985 19.4534 31.9985 23.8316V31.6667C31.9985 32.5707 31.28 33.2912 30.3749 33.2912H6.15532V33.2946Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M30.896 35.1547L5.73676 35.2586C4.80059 35.2621 3.75042 35.8232 3.37388 36.5229L2.90061 37.4027L0.537726 41.7878L0.140457 42.529C-0.236085 43.2253 0.164639 43.7829 1.10081 43.7795L26.26 43.6756C27.1962 43.6721 28.2464 43.111 28.6229 42.4113L29.0962 41.5315L31.4591 37.1463L31.8563 36.4051C32.2329 35.7089 31.8321 35.1512 30.896 35.1547Z" fill="#605DC8"/> <path d="M2.54861 18.7156C2.23079 18.7156 1.90952 18.629 1.6228 18.4454C0.821352 17.9363 0.5899 16.859 1.09771 16.0554C1.46389 15.4701 2.70061 14.2231 5.50912 11.4659L6.39693 10.5931C8.73218 8.38318 10.5147 6.56817 11.9449 5.10646C15.1679 1.81587 16.7985 0.153263 18.9023 0.222538C20.9888 0.277958 22.4362 1.92325 25.3138 5.19651C26.7267 6.8037 28.4816 8.8023 30.8514 11.2477C30.8652 11.265 30.8825 11.2789 30.8963 11.2962C31.228 11.6634 31.715 12.2003 32.2401 12.7752C33.9743 14.6734 34.8206 15.6086 35.0763 15.9688C35.629 16.7413 35.4494 17.8185 34.679 18.3727C33.9087 18.9234 32.8343 18.7468 32.2816 17.9744C32.0639 17.6869 30.5889 16.0693 29.708 15.1064C29.1863 14.5348 28.6993 14.0014 28.3642 13.6308C25.9495 11.1369 24.1704 9.11057 22.7368 7.4826C21.0233 5.5325 19.4032 3.68977 18.809 3.67245H18.8021C18.1699 3.67245 16.3356 5.54289 14.3976 7.52417C12.9467 9.00666 11.14 10.8494 8.78054 13.0766L7.91001 13.9321C6.74929 15.0717 4.33804 17.4375 3.97877 17.9293C3.65405 18.4454 3.10824 18.7225 2.54515 18.7225L2.54861 18.7156Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M22.0976 33.2115V26.0588C22.0976 25.4665 21.6174 24.985 21.0267 24.985H15.1955C14.6047 24.985 14.1246 25.4665 14.1246 26.0588V33.2115C14.1246 33.2704 14.1142 33.3293 14.0969 33.3847H22.1252C22.1079 33.3293 22.0976 33.2739 22.0976 33.2115Z" fill="white"/>
{ "end_byte": 2207, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg_2208_5628
<path d="M58.9784 10.0512V32.2205H54.5319V22.7874H45.0353V32.2205H40.5887V10.0512H45.0353V19.1666H54.5319V10.0512H58.9784ZM70.8506 32.5063C69.1567 32.5063 67.6322 32.1358 66.277 31.3947C64.9219 30.6324 63.8526 29.5631 63.0692 28.1868C62.3069 26.8105 61.9258 25.2224 61.9258 23.4226C61.9258 21.6228 62.3175 20.0348 63.1009 18.6585C63.9055 17.2821 64.996 16.2234 66.3723 15.4823C67.7486 14.7201 69.2838 14.3389 70.9777 14.3389C72.6716 14.3389 74.2067 14.7201 75.5831 15.4823C76.9594 16.2234 78.0393 17.2821 78.8227 18.6585C79.6273 20.0348 80.0296 21.6228 80.0296 23.4226C80.0296 25.2224 79.6167 26.8105 78.7909 28.1868C77.9863 29.5631 76.8853 30.6324 75.4878 31.3947C74.1115 32.1358 72.5657 32.5063 70.8506 32.5063ZM70.8506 28.6315C71.6553 28.6315 72.4069 28.4409 73.1057 28.0597C73.8256 27.6574 74.3973 27.0646 74.8208 26.2811C75.2443 25.4977 75.456 24.5449 75.456 23.4226C75.456 21.7499 75.0114 20.4688 74.122 19.5795C73.2539 18.669 72.1846 18.2138 70.9142 18.2138C69.6437 18.2138 68.5744 18.669 67.7063 19.5795C66.8593 20.4688 66.4358 21.7499 66.4358 23.4226C66.4358 25.0954 66.8487 26.387 67.6745 27.2975C68.5215 28.1868 69.5802 28.6315 70.8506 28.6315ZM104.825 14.3707C106.985 14.3707 108.721 15.0377 110.034 16.3717C111.368 17.6844 112.035 19.5266 112.035 21.8981V32.2205H107.589V22.5016C107.589 21.1252 107.239 20.0771 106.54 19.3572C105.842 18.6161 104.889 18.2456 103.682 18.2456C102.475 18.2456 101.512 18.6161 100.792 19.3572C100.093 20.0771 99.7436 21.1252 99.7436 22.5016V32.2205H95.297V22.5016C95.297 21.1252 94.9477 20.0771 94.2489 19.3572C93.5502 18.6161 92.5974 18.2456 91.3904 18.2456C90.1623 18.2456 89.1883 18.6161 88.4684 19.3572C87.7697 20.0771 87.4203 21.1252 87.4203 22.5016V32.2205H82.9737V14.6248H87.4203V16.7528C87.992 16.0117 88.7225 15.4294 89.6118 15.0059C90.5223 14.5824 91.5175 14.3707 92.5974 14.3707C93.9737 14.3707 95.2018 14.6671 96.2816 15.26C97.3615 15.8317 98.1979 16.6575 98.7908 17.7374C99.3625 16.721 100.188 15.9058 101.268 15.2918C102.369 14.6777 103.555 14.3707 104.825 14.3707ZM132.294 23.0415C132.294 23.6767 132.252 24.2484 132.167 24.7566H119.304C119.41 26.027 119.854 27.0222 120.638 27.7421C121.421 28.4621 122.385 28.822 123.528 28.822C125.18 28.822 126.355 28.1127 127.053 26.694H131.849C131.341 28.3879 130.367 29.7854 128.927 30.8865C127.488 31.9664 125.72 32.5063 123.623 32.5063C121.929 32.5063 120.405 32.1358 119.05 31.3947C117.716 30.6324 116.668 29.5631 115.905 28.1868C115.164 26.8105 114.794 25.2224 114.794 23.4226C114.794 21.6017 115.164 20.003 115.905 18.6267C116.646 17.2504 117.684 16.1917 119.018 15.4506C120.352 14.7095 121.887 14.3389 123.623 14.3389C125.296 14.3389 126.789 14.6989 128.102 15.4188C129.436 16.1387 130.462 17.1657 131.182 18.4996C131.924 19.8124 132.294 21.3264 132.294 23.0415ZM127.689 21.771C127.668 20.6276 127.255 19.7172 126.45 19.0396C125.645 18.3408 124.661 17.9915 123.496 17.9915C122.395 17.9915 121.464 18.3303 120.701 19.0078C119.96 19.6642 119.505 20.5853 119.336 21.771H127.689ZM141.955 32.5063C140.516 32.5063 139.224 32.2522 138.081 31.744C136.937 31.2147 136.027 30.5054 135.349 29.616C134.693 28.7267 134.333 27.7421 134.269 26.6623H138.748C138.832 27.3398 139.16 27.9009 139.732 28.3456C140.325 28.7903 141.055 29.0126 141.924 29.0126C142.771 29.0126 143.427 28.8432 143.893 28.5044C144.38 28.1656 144.623 27.7316 144.623 27.2022C144.623 26.6305 144.327 26.207 143.734 25.9318C143.162 25.6353 142.241 25.3177 140.971
{ "end_byte": 5628, "start_byte": 2208, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg_5629_6611
24.9789C139.658 24.6613 138.578 24.3331 137.731 23.9943C136.905 23.6555 136.185 23.1368 135.571 22.438C134.979 21.7393 134.682 20.797 134.682 19.6113C134.682 18.6373 134.957 17.748 135.508 16.9434C136.08 16.1387 136.884 15.5035 137.922 15.0377C138.98 14.5719 140.219 14.3389 141.638 14.3389C143.734 14.3389 145.407 14.8683 146.656 15.927C147.905 16.9645 148.593 18.3726 148.721 20.1512H144.465C144.401 19.4525 144.105 18.902 143.575 18.4996C143.067 18.0762 142.379 17.8644 141.511 17.8644C140.706 17.8644 140.081 18.0126 139.637 18.3091C139.213 18.6055 139.002 19.0184 139.002 19.5478C139.002 20.1406 139.298 20.5959 139.891 20.9135C140.484 21.2099 141.405 21.517 142.654 21.8346C143.925 22.1522 144.973 22.4804 145.798 22.8192C146.624 23.1579 147.334 23.6873 147.926 24.4072C148.541 25.106 148.858 26.0376 148.879 27.2022C148.879 28.2186 148.593 29.129 148.022 29.9337C147.471 30.7383 146.667 31.3735 145.608 31.8393C144.57 32.284 143.353 32.5063 141.955 32.5063Z" fill="#605DC8"/>
{ "end_byte": 6611, "start_byte": 5629, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg_6612_6619
</svg>
{ "end_byte": 6619, "start_byte": 6612, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/11-details-page/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/README.md_0_2955
# Add an input parameter to the component This tutorial lesson demonstrates how to create a component `@Input()` and use it to pass data to a component for customization. <docs-video src="https://www.youtube.com/embed/eM3zi_n7lNs?si=WvRGFSkW_7_zDIFD&amp;start=241"/> ## What you'll learn Your app's `HousingLocationComponent` template has a `HousingLocation` property to receive input. ## Conceptual preview of Inputs [Inputs](api/core/Input) allow components to share data. The direction of the data sharing is from parent component to child component. In this lesson, you'll define `@Input()` properties in the `HousingLocationComponent` component which will enable you to customize the data displayed in the component. Learn more in the [Accepting data with input properties](guide/components/inputs) and [Custom events with outputs](guide/components/outputs) guides. <docs-workflow> <docs-step title="Import the Input decorator"> This step imports the `Input` decorator into the class. In the code editor: 1. Navigate to `src/app/housing-location/housing-location.component.ts` 1. Update the file imports to include `Input` and `HousingLocation`: <docs-code header="Import HousingLocationComponent and Input in src/app/housing-location/housing-location.component.ts" path="adev/src/content/tutorials/first-app/steps/06-property-binding/src/app/housing-location/housing-location.component.ts" visibleLines="[1,3]"/> </docs-step> <docs-step title="Add the Input property"> 1. In the same file, add a property called `housingLocation` of type `HousingLocation` to the `HousingLocationComponent` class. Add an `!` after the property name and prefix it with the `@Input()` decorator: <docs-code header="Import HousingLocationComponent and Input in src/app/housing-location/housing-location.component.ts" path="adev/src/content/tutorials/first-app/steps/06-property-binding/src/app/housing-location/housing-location.component.ts" visibleLines="[13,15]"/> You have to add the `!` because the input is expecting the value to be passed. In this case, there is no default value. In our example application case we know that the value will be passed in - this is by design. The exclamation point is called the non-null assertion operator and it tells the TypeScript compiler that the value of this property won't be null or undefined. 1. Save your changes and confirm the app does not have any errors. 1. Correct any errors before you continue to the next step. </docs-step> </docs-workflow> Summary: In this lesson, you created a new property decorated with the `@Input()` decorator. You also used the non-null assertion operator to notify the compiler that the value of the new property won't be `null` or `undefined`. <docs-pill-row> <docs-pill href="guide/components/inputs" title="Accepting data with input properties"/> <docs-pill href="guide/components/outputs" title="Custom events with outputs"/> </docs-pill-row>
{ "end_byte": 2955, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/README.md" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/index.html_0_427
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Homes</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 427, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/index.html" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/main.ts_0_420
/* * Protractor support is deprecated in Angular. * Protractor is used in this example for compatibility with Angular documentation tools. */ import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, {providers: [provideProtractorTestingSupport()]}).catch((err) => console.error(err), );
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/main.ts" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/styles.css_0_443
/* You can add global styles to this file, and also import other style files */ * { margin: 0; padding: 0; } body { font-family: 'Be Vietnam Pro', sans-serif; } :root { --primary-color: #605DC8; --secondary-color: #8B89E6; --accent-color: #e8e7fa; --shadow-color: #E8E8E8; } button.primary { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; }
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/styles.css" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housinglocation.ts_0_180
export interface HousingLocation { id: number; name: string; city: string; state: string; photo: string; availableUnits: number; wifi: boolean; laundry: boolean; }
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housinglocation.ts" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/app.component.ts_0_529
import {Component} from '@angular/core'; import {HomeComponent} from './home/home.component'; @Component({ selector: 'app-root', standalone: true, imports: [HomeComponent], template: ` <main> <header class="brand-name"> <img class="brand-logo" src="/assets/logo.svg" alt="logo" aria-hidden="true" /> </header> <section class="content"> <app-home></app-home> </section> </main> `, styleUrls: ['./app.component.css'], }) export class AppComponent { title = 'homes'; }
{ "end_byte": 529, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/app.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/app.component.css_0_213
:host { --content-padding: 10px; } header { display: block; height: 60px; padding: var(--content-padding); box-shadow: 0px 5px 25px var(--shadow-color); } .content { padding: var(--content-padding); }
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/app.component.css" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.component.ts_0_1010
import {Component} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocationComponent} from '../housing-location/housing-location.component'; import {HousingLocation} from '../housinglocation'; @Component({ selector: 'app-home', standalone: true, imports: [CommonModule, HousingLocationComponent], template: ` <section> <form> <input type="text" placeholder="Filter by city" /> <button class="primary" type="button">Search</button> </form> </section> <section class="results"> <app-housing-location></app-housing-location> </section> `, styleUrls: ['./home.component.css'], }) export class HomeComponent { readonly baseUrl = 'https://angular.dev/assets/images/tutorials/common'; housingLocation: HousingLocation = { id: 9999, name: 'Test Home', city: 'Test city', state: 'ST', photo: `${this.baseUrl}/example-house.jpg`, availableUnits: 99, wifi: true, laundry: false, }; }
{ "end_byte": 1010, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.component.css_0_746
.results { display: grid; column-gap: 14px; row-gap: 14px; grid-template-columns: repeat(auto-fill, minmax(400px, 400px)); margin-top: 50px; justify-content: space-around; } input[type="text"] { border: solid 1px var(--primary-color); padding: 10px; border-radius: 8px; margin-right: 4px; display: inline-block; width: 30%; } button { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; } @media (min-width: 500px) and (max-width: 768px) { .results { grid-template-columns: repeat(2, 1fr); } input[type="text"] { width: 70%; } } @media (max-width: 499px) { .results { grid-template-columns: 1fr; } }
{ "end_byte": 746, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/home/home.component.css" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housing-location/housing-location.component.css_0_583
.listing { background: var(--accent-color); border-radius: 30px; padding-bottom: 30px; } .listing-heading { color: var(--primary-color); padding: 10px 20px 0 20px; } .listing-photo { height: 250px; width: 100%; object-fit: cover; border-radius: 30px 30px 0 0; } .listing-location { padding: 10px 20px 20px 20px; } .listing-location::before { content: url("/assets/location-pin.svg") / ""; } section.listing a { padding-left: 20px; text-decoration: none; color: var(--primary-color); } section.listing a::after { content: "\203A"; margin-left: 5px; }
{ "end_byte": 583, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housing-location/housing-location.component.css" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housing-location/housing-location.component.ts_0_333
import {Component} from '@angular/core'; import {CommonModule} from '@angular/common'; @Component({ selector: 'app-housing-location', standalone: true, imports: [CommonModule], template: ` <p>housing-location works!</p> `, styleUrls: ['./housing-location.component.css'], }) export class HousingLocationComponent {}
{ "end_byte": 333, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/app/housing-location/housing-location.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/location-pin.svg_0_502
<?xml version="1.0" encoding="UTF-8"?> <svg width="20pt" height="20pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 11.602c-15.398 0-27.898 12.5-27.898 27.898 0 5 1.3008 9.6992 3.6016 13.801l2.8984 4.1992 21.398 30.898 21.801-31.398 2.1992-3.1992c2.5-4.1992 3.8984-9 3.8984-14.199 0-15.5-12.5-28-27.898-28zm0 35.598c-4.1992 0-7.6992-3.3984-7.6992-7.6992s3.3984-7.6992 7.6992-7.6992 7.6992 3.3984 7.6992 7.6992-3.5 7.6992-7.6992 7.6992z" fill="#605cc8"/> </svg>
{ "end_byte": 502, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/location-pin.svg" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg_0_2207
<svg width="151" height="44" viewBox="0 0 151 44" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M6.15532 33.2946C5.25369 33.2946 4.58006 32.5707 4.58006 31.6701V24.0152C4.58006 19.5469 4.35206 20.6276 7.59585 17.4236C21.7317 4.06732 16.2425 4.24744 29.6149 18.054C32.0434 20.7627 31.9985 19.4534 31.9985 23.8316V31.6667C31.9985 32.5707 31.28 33.2912 30.3749 33.2912H6.15532V33.2946Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M30.896 35.1547L5.73676 35.2586C4.80059 35.2621 3.75042 35.8232 3.37388 36.5229L2.90061 37.4027L0.537726 41.7878L0.140457 42.529C-0.236085 43.2253 0.164639 43.7829 1.10081 43.7795L26.26 43.6756C27.1962 43.6721 28.2464 43.111 28.6229 42.4113L29.0962 41.5315L31.4591 37.1463L31.8563 36.4051C32.2329 35.7089 31.8321 35.1512 30.896 35.1547Z" fill="#605DC8"/> <path d="M2.54861 18.7156C2.23079 18.7156 1.90952 18.629 1.6228 18.4454C0.821352 17.9363 0.5899 16.859 1.09771 16.0554C1.46389 15.4701 2.70061 14.2231 5.50912 11.4659L6.39693 10.5931C8.73218 8.38318 10.5147 6.56817 11.9449 5.10646C15.1679 1.81587 16.7985 0.153263 18.9023 0.222538C20.9888 0.277958 22.4362 1.92325 25.3138 5.19651C26.7267 6.8037 28.4816 8.8023 30.8514 11.2477C30.8652 11.265 30.8825 11.2789 30.8963 11.2962C31.228 11.6634 31.715 12.2003 32.2401 12.7752C33.9743 14.6734 34.8206 15.6086 35.0763 15.9688C35.629 16.7413 35.4494 17.8185 34.679 18.3727C33.9087 18.9234 32.8343 18.7468 32.2816 17.9744C32.0639 17.6869 30.5889 16.0693 29.708 15.1064C29.1863 14.5348 28.6993 14.0014 28.3642 13.6308C25.9495 11.1369 24.1704 9.11057 22.7368 7.4826C21.0233 5.5325 19.4032 3.68977 18.809 3.67245H18.8021C18.1699 3.67245 16.3356 5.54289 14.3976 7.52417C12.9467 9.00666 11.14 10.8494 8.78054 13.0766L7.91001 13.9321C6.74929 15.0717 4.33804 17.4375 3.97877 17.9293C3.65405 18.4454 3.10824 18.7225 2.54515 18.7225L2.54861 18.7156Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M22.0976 33.2115V26.0588C22.0976 25.4665 21.6174 24.985 21.0267 24.985H15.1955C14.6047 24.985 14.1246 25.4665 14.1246 26.0588V33.2115C14.1246 33.2704 14.1142 33.3293 14.0969 33.3847H22.1252C22.1079 33.3293 22.0976 33.2739 22.0976 33.2115Z" fill="white"/>
{ "end_byte": 2207, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg_2208_5628
<path d="M58.9784 10.0512V32.2205H54.5319V22.7874H45.0353V32.2205H40.5887V10.0512H45.0353V19.1666H54.5319V10.0512H58.9784ZM70.8506 32.5063C69.1567 32.5063 67.6322 32.1358 66.277 31.3947C64.9219 30.6324 63.8526 29.5631 63.0692 28.1868C62.3069 26.8105 61.9258 25.2224 61.9258 23.4226C61.9258 21.6228 62.3175 20.0348 63.1009 18.6585C63.9055 17.2821 64.996 16.2234 66.3723 15.4823C67.7486 14.7201 69.2838 14.3389 70.9777 14.3389C72.6716 14.3389 74.2067 14.7201 75.5831 15.4823C76.9594 16.2234 78.0393 17.2821 78.8227 18.6585C79.6273 20.0348 80.0296 21.6228 80.0296 23.4226C80.0296 25.2224 79.6167 26.8105 78.7909 28.1868C77.9863 29.5631 76.8853 30.6324 75.4878 31.3947C74.1115 32.1358 72.5657 32.5063 70.8506 32.5063ZM70.8506 28.6315C71.6553 28.6315 72.4069 28.4409 73.1057 28.0597C73.8256 27.6574 74.3973 27.0646 74.8208 26.2811C75.2443 25.4977 75.456 24.5449 75.456 23.4226C75.456 21.7499 75.0114 20.4688 74.122 19.5795C73.2539 18.669 72.1846 18.2138 70.9142 18.2138C69.6437 18.2138 68.5744 18.669 67.7063 19.5795C66.8593 20.4688 66.4358 21.7499 66.4358 23.4226C66.4358 25.0954 66.8487 26.387 67.6745 27.2975C68.5215 28.1868 69.5802 28.6315 70.8506 28.6315ZM104.825 14.3707C106.985 14.3707 108.721 15.0377 110.034 16.3717C111.368 17.6844 112.035 19.5266 112.035 21.8981V32.2205H107.589V22.5016C107.589 21.1252 107.239 20.0771 106.54 19.3572C105.842 18.6161 104.889 18.2456 103.682 18.2456C102.475 18.2456 101.512 18.6161 100.792 19.3572C100.093 20.0771 99.7436 21.1252 99.7436 22.5016V32.2205H95.297V22.5016C95.297 21.1252 94.9477 20.0771 94.2489 19.3572C93.5502 18.6161 92.5974 18.2456 91.3904 18.2456C90.1623 18.2456 89.1883 18.6161 88.4684 19.3572C87.7697 20.0771 87.4203 21.1252 87.4203 22.5016V32.2205H82.9737V14.6248H87.4203V16.7528C87.992 16.0117 88.7225 15.4294 89.6118 15.0059C90.5223 14.5824 91.5175 14.3707 92.5974 14.3707C93.9737 14.3707 95.2018 14.6671 96.2816 15.26C97.3615 15.8317 98.1979 16.6575 98.7908 17.7374C99.3625 16.721 100.188 15.9058 101.268 15.2918C102.369 14.6777 103.555 14.3707 104.825 14.3707ZM132.294 23.0415C132.294 23.6767 132.252 24.2484 132.167 24.7566H119.304C119.41 26.027 119.854 27.0222 120.638 27.7421C121.421 28.4621 122.385 28.822 123.528 28.822C125.18 28.822 126.355 28.1127 127.053 26.694H131.849C131.341 28.3879 130.367 29.7854 128.927 30.8865C127.488 31.9664 125.72 32.5063 123.623 32.5063C121.929 32.5063 120.405 32.1358 119.05 31.3947C117.716 30.6324 116.668 29.5631 115.905 28.1868C115.164 26.8105 114.794 25.2224 114.794 23.4226C114.794 21.6017 115.164 20.003 115.905 18.6267C116.646 17.2504 117.684 16.1917 119.018 15.4506C120.352 14.7095 121.887 14.3389 123.623 14.3389C125.296 14.3389 126.789 14.6989 128.102 15.4188C129.436 16.1387 130.462 17.1657 131.182 18.4996C131.924 19.8124 132.294 21.3264 132.294 23.0415ZM127.689 21.771C127.668 20.6276 127.255 19.7172 126.45 19.0396C125.645 18.3408 124.661 17.9915 123.496 17.9915C122.395 17.9915 121.464 18.3303 120.701 19.0078C119.96 19.6642 119.505 20.5853 119.336 21.771H127.689ZM141.955 32.5063C140.516 32.5063 139.224 32.2522 138.081 31.744C136.937 31.2147 136.027 30.5054 135.349 29.616C134.693 28.7267 134.333 27.7421 134.269 26.6623H138.748C138.832 27.3398 139.16 27.9009 139.732 28.3456C140.325 28.7903 141.055 29.0126 141.924 29.0126C142.771 29.0126 143.427 28.8432 143.893 28.5044C144.38 28.1656 144.623 27.7316 144.623 27.2022C144.623 26.6305 144.327 26.207 143.734 25.9318C143.162 25.6353 142.241 25.3177 140.971
{ "end_byte": 5628, "start_byte": 2208, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg_5629_6611
24.9789C139.658 24.6613 138.578 24.3331 137.731 23.9943C136.905 23.6555 136.185 23.1368 135.571 22.438C134.979 21.7393 134.682 20.797 134.682 19.6113C134.682 18.6373 134.957 17.748 135.508 16.9434C136.08 16.1387 136.884 15.5035 137.922 15.0377C138.98 14.5719 140.219 14.3389 141.638 14.3389C143.734 14.3389 145.407 14.8683 146.656 15.927C147.905 16.9645 148.593 18.3726 148.721 20.1512H144.465C144.401 19.4525 144.105 18.902 143.575 18.4996C143.067 18.0762 142.379 17.8644 141.511 17.8644C140.706 17.8644 140.081 18.0126 139.637 18.3091C139.213 18.6055 139.002 19.0184 139.002 19.5478C139.002 20.1406 139.298 20.5959 139.891 20.9135C140.484 21.2099 141.405 21.517 142.654 21.8346C143.925 22.1522 144.973 22.4804 145.798 22.8192C146.624 23.1579 147.334 23.6873 147.926 24.4072C148.541 25.106 148.858 26.0376 148.879 27.2022C148.879 28.2186 148.593 29.129 148.022 29.9337C147.471 30.7383 146.667 31.3735 145.608 31.8393C144.57 32.284 143.353 32.5063 141.955 32.5063Z" fill="#605DC8"/>
{ "end_byte": 6611, "start_byte": 5629, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg_6612_6619
</svg>
{ "end_byte": 6619, "start_byte": 6612, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/05-inputs/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/README.md_0_3346
# Use *ngFor to list objects in component This tutorial lesson demonstrates how to use `ngFor` directive in Angular templates in order to display dynamically repeated data in a template. <docs-video src="https://www.youtube.com/embed/eM3zi_n7lNs?si=MIl5NcRxvcLjYt5f&amp;start=477"/> ## What you'll learn * You will have added a data set to the app * Your app will display a list of elements from the new data set using `ngFor` ## Conceptual preview of ngFor In Angular, `ngFor` is a specific type of [directive](guide/directives) used to dynamically repeat data in a template. In plain JavaScript you would use a for loop - ngFor provides similar functionality for Angular templates. You can utilize `ngFor` to iterate over arrays and even asynchronous values. In this lesson, you'll add a new array of data to iterate over. For a more in depth explanation, please refer to the [Built-in directives](guide/directives#ngFor) guide. <docs-workflow> <docs-step title="Add housing data to the `HomeComponent`"> In the `HomeComponent` there is only a single housing location. In this step, you will add an array of `HousingLocation` entries. 1. In `src/app/home/home.component.ts`, remove the `housingLocation` property from the `HomeComponent` class. 1. Update the `HomeComponent` class to have a property called `housingLocationList`. Update your code to match the following code: <docs-code header="Add housingLocationList property" path="adev/src/content/tutorials/first-app/steps/09-services/src/app/home/home.component.ts" visibleLines="26-131"/> IMPORTANT: Do not remove the `@Component` decorator, you will update that code in an upcoming step. </docs-step> <docs-step title="Update the `HomeComponent` template to use `ngFor`"> Now the app has a dataset that you can use to display the entries in the browser using the `ngFor` directive. 1. Update the `<app-housing-location>` tag in the template code to this: <docs-code header="Add ngFor to HomeComponent template" path="adev/src/content/tutorials/first-app/steps/09-services/src/app/home/home.component.ts" visibleLines="[17,22]"/> Note, in the code `[housingLocation] = "housingLocation"` the `housingLocation` value now refers to the variable used in the `ngFor` directive. Before this change, it referred to the property on the `HomeComponent` class. 1. Save all changes. 1. Refresh the browser and confirm that the app now renders a grid of housing locations. <section class="lightbox"> <img alt="browser frame of homes-app displaying logo, filter text input box, search button and a grid of housing location cards" src="assets/images/tutorials/first-app/homes-app-lesson-08-step-2.png"> </section> </docs-step> </docs-workflow> Summary: In this lesson, you used the `ngFor` directive to repeat data dynamically in Angular templates. You also added a new array of data to be used in the Angular app. The application now dynamically renders a list of housing locations in the browser. The app is taking shape, great job. For more information about the topics covered in this lesson, visit: <docs-pill-row> <docs-pill href="guide/directives/structural-directives" title="Structural Directives"/> <docs-pill href="guide/directives#ngFor" title="ngFor guide"/> <docs-pill href="api/common/NgFor" title="ngFor"/> </docs-pill-row>
{ "end_byte": 3346, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/README.md" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/index.html_0_427
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Homes</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 427, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/index.html" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/main.ts_0_420
/* * Protractor support is deprecated in Angular. * Protractor is used in this example for compatibility with Angular documentation tools. */ import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, {providers: [provideProtractorTestingSupport()]}).catch((err) => console.error(err), );
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/main.ts" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/styles.css_0_443
/* You can add global styles to this file, and also import other style files */ * { margin: 0; padding: 0; } body { font-family: 'Be Vietnam Pro', sans-serif; } :root { --primary-color: #605DC8; --secondary-color: #8B89E6; --accent-color: #e8e7fa; --shadow-color: #E8E8E8; } button.primary { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; }
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/styles.css" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housinglocation.ts_0_180
export interface HousingLocation { id: number; name: string; city: string; state: string; photo: string; availableUnits: number; wifi: boolean; laundry: boolean; }
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housinglocation.ts" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/app.component.ts_0_529
import {Component} from '@angular/core'; import {HomeComponent} from './home/home.component'; @Component({ selector: 'app-root', standalone: true, imports: [HomeComponent], template: ` <main> <header class="brand-name"> <img class="brand-logo" src="/assets/logo.svg" alt="logo" aria-hidden="true" /> </header> <section class="content"> <app-home></app-home> </section> </main> `, styleUrls: ['./app.component.css'], }) export class AppComponent { title = 'homes'; }
{ "end_byte": 529, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/app.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/app.component.css_0_213
:host { --content-padding: 10px; } header { display: block; height: 60px; padding: var(--content-padding); box-shadow: 0px 5px 25px var(--shadow-color); } .content { padding: var(--content-padding); }
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/app.component.css" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/home/home.component.ts_0_1046
import {Component} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocationComponent} from '../housing-location/housing-location.component'; import {HousingLocation} from '../housinglocation'; @Component({ selector: 'app-home', standalone: true, imports: [CommonModule, HousingLocationComponent], template: ` <section> <form> <input type="text" placeholder="Filter by city" /> <button class="primary" type="button">Search</button> </form> </section> <section class="results"> <app-housing-location [housingLocation]="housingLocation"></app-housing-location> </section> `, styleUrls: ['./home.component.css'], }) export class HomeComponent { readonly baseUrl = 'https://angular.dev/assets/images/tutorials/common'; housingLocation: HousingLocation = { id: 9999, name: 'Test Home', city: 'Test city', state: 'ST', photo: `${this.baseUrl}/example-house.jpg`, availableUnits: 99, wifi: true, laundry: false, }; }
{ "end_byte": 1046, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/home/home.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/home/home.component.css_0_746
.results { display: grid; column-gap: 14px; row-gap: 14px; grid-template-columns: repeat(auto-fill, minmax(400px, 400px)); margin-top: 50px; justify-content: space-around; } input[type="text"] { border: solid 1px var(--primary-color); padding: 10px; border-radius: 8px; margin-right: 4px; display: inline-block; width: 30%; } button { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; } @media (min-width: 500px) and (max-width: 768px) { .results { grid-template-columns: repeat(2, 1fr); } input[type="text"] { width: 70%; } } @media (max-width: 499px) { .results { grid-template-columns: 1fr; } }
{ "end_byte": 746, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/home/home.component.css" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housing-location/housing-location.component.css_0_583
.listing { background: var(--accent-color); border-radius: 30px; padding-bottom: 30px; } .listing-heading { color: var(--primary-color); padding: 10px 20px 0 20px; } .listing-photo { height: 250px; width: 100%; object-fit: cover; border-radius: 30px 30px 0 0; } .listing-location { padding: 10px 20px 20px 20px; } .listing-location::before { content: url("/assets/location-pin.svg") / ""; } section.listing a { padding-left: 20px; text-decoration: none; color: var(--primary-color); } section.listing a::after { content: "\203A"; margin-left: 5px; }
{ "end_byte": 583, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housing-location/housing-location.component.css" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housing-location/housing-location.component.ts_0_776
import {Component, Input} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocation} from '../housinglocation'; @Component({ selector: 'app-housing-location', standalone: true, imports: [CommonModule], template: ` <section class="listing"> <img class="listing-photo" [src]="housingLocation.photo" alt="Exterior photo of {{ housingLocation.name }}" crossorigin /> <h2 class="listing-heading">{{ housingLocation.name }}</h2> <p class="listing-location">{{ housingLocation.city }}, {{ housingLocation.state }}</p> </section> `, styleUrls: ['./housing-location.component.css'], }) export class HousingLocationComponent { @Input() housingLocation!: HousingLocation; }
{ "end_byte": 776, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housing-location/housing-location.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/location-pin.svg_0_502
<?xml version="1.0" encoding="UTF-8"?> <svg width="20pt" height="20pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 11.602c-15.398 0-27.898 12.5-27.898 27.898 0 5 1.3008 9.6992 3.6016 13.801l2.8984 4.1992 21.398 30.898 21.801-31.398 2.1992-3.1992c2.5-4.1992 3.8984-9 3.8984-14.199 0-15.5-12.5-28-27.898-28zm0 35.598c-4.1992 0-7.6992-3.3984-7.6992-7.6992s3.3984-7.6992 7.6992-7.6992 7.6992 3.3984 7.6992 7.6992-3.5 7.6992-7.6992 7.6992z" fill="#605cc8"/> </svg>
{ "end_byte": 502, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/location-pin.svg" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg_0_2207
<svg width="151" height="44" viewBox="0 0 151 44" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M6.15532 33.2946C5.25369 33.2946 4.58006 32.5707 4.58006 31.6701V24.0152C4.58006 19.5469 4.35206 20.6276 7.59585 17.4236C21.7317 4.06732 16.2425 4.24744 29.6149 18.054C32.0434 20.7627 31.9985 19.4534 31.9985 23.8316V31.6667C31.9985 32.5707 31.28 33.2912 30.3749 33.2912H6.15532V33.2946Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M30.896 35.1547L5.73676 35.2586C4.80059 35.2621 3.75042 35.8232 3.37388 36.5229L2.90061 37.4027L0.537726 41.7878L0.140457 42.529C-0.236085 43.2253 0.164639 43.7829 1.10081 43.7795L26.26 43.6756C27.1962 43.6721 28.2464 43.111 28.6229 42.4113L29.0962 41.5315L31.4591 37.1463L31.8563 36.4051C32.2329 35.7089 31.8321 35.1512 30.896 35.1547Z" fill="#605DC8"/> <path d="M2.54861 18.7156C2.23079 18.7156 1.90952 18.629 1.6228 18.4454C0.821352 17.9363 0.5899 16.859 1.09771 16.0554C1.46389 15.4701 2.70061 14.2231 5.50912 11.4659L6.39693 10.5931C8.73218 8.38318 10.5147 6.56817 11.9449 5.10646C15.1679 1.81587 16.7985 0.153263 18.9023 0.222538C20.9888 0.277958 22.4362 1.92325 25.3138 5.19651C26.7267 6.8037 28.4816 8.8023 30.8514 11.2477C30.8652 11.265 30.8825 11.2789 30.8963 11.2962C31.228 11.6634 31.715 12.2003 32.2401 12.7752C33.9743 14.6734 34.8206 15.6086 35.0763 15.9688C35.629 16.7413 35.4494 17.8185 34.679 18.3727C33.9087 18.9234 32.8343 18.7468 32.2816 17.9744C32.0639 17.6869 30.5889 16.0693 29.708 15.1064C29.1863 14.5348 28.6993 14.0014 28.3642 13.6308C25.9495 11.1369 24.1704 9.11057 22.7368 7.4826C21.0233 5.5325 19.4032 3.68977 18.809 3.67245H18.8021C18.1699 3.67245 16.3356 5.54289 14.3976 7.52417C12.9467 9.00666 11.14 10.8494 8.78054 13.0766L7.91001 13.9321C6.74929 15.0717 4.33804 17.4375 3.97877 17.9293C3.65405 18.4454 3.10824 18.7225 2.54515 18.7225L2.54861 18.7156Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M22.0976 33.2115V26.0588C22.0976 25.4665 21.6174 24.985 21.0267 24.985H15.1955C14.6047 24.985 14.1246 25.4665 14.1246 26.0588V33.2115C14.1246 33.2704 14.1142 33.3293 14.0969 33.3847H22.1252C22.1079 33.3293 22.0976 33.2739 22.0976 33.2115Z" fill="white"/>
{ "end_byte": 2207, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg_2208_5628
<path d="M58.9784 10.0512V32.2205H54.5319V22.7874H45.0353V32.2205H40.5887V10.0512H45.0353V19.1666H54.5319V10.0512H58.9784ZM70.8506 32.5063C69.1567 32.5063 67.6322 32.1358 66.277 31.3947C64.9219 30.6324 63.8526 29.5631 63.0692 28.1868C62.3069 26.8105 61.9258 25.2224 61.9258 23.4226C61.9258 21.6228 62.3175 20.0348 63.1009 18.6585C63.9055 17.2821 64.996 16.2234 66.3723 15.4823C67.7486 14.7201 69.2838 14.3389 70.9777 14.3389C72.6716 14.3389 74.2067 14.7201 75.5831 15.4823C76.9594 16.2234 78.0393 17.2821 78.8227 18.6585C79.6273 20.0348 80.0296 21.6228 80.0296 23.4226C80.0296 25.2224 79.6167 26.8105 78.7909 28.1868C77.9863 29.5631 76.8853 30.6324 75.4878 31.3947C74.1115 32.1358 72.5657 32.5063 70.8506 32.5063ZM70.8506 28.6315C71.6553 28.6315 72.4069 28.4409 73.1057 28.0597C73.8256 27.6574 74.3973 27.0646 74.8208 26.2811C75.2443 25.4977 75.456 24.5449 75.456 23.4226C75.456 21.7499 75.0114 20.4688 74.122 19.5795C73.2539 18.669 72.1846 18.2138 70.9142 18.2138C69.6437 18.2138 68.5744 18.669 67.7063 19.5795C66.8593 20.4688 66.4358 21.7499 66.4358 23.4226C66.4358 25.0954 66.8487 26.387 67.6745 27.2975C68.5215 28.1868 69.5802 28.6315 70.8506 28.6315ZM104.825 14.3707C106.985 14.3707 108.721 15.0377 110.034 16.3717C111.368 17.6844 112.035 19.5266 112.035 21.8981V32.2205H107.589V22.5016C107.589 21.1252 107.239 20.0771 106.54 19.3572C105.842 18.6161 104.889 18.2456 103.682 18.2456C102.475 18.2456 101.512 18.6161 100.792 19.3572C100.093 20.0771 99.7436 21.1252 99.7436 22.5016V32.2205H95.297V22.5016C95.297 21.1252 94.9477 20.0771 94.2489 19.3572C93.5502 18.6161 92.5974 18.2456 91.3904 18.2456C90.1623 18.2456 89.1883 18.6161 88.4684 19.3572C87.7697 20.0771 87.4203 21.1252 87.4203 22.5016V32.2205H82.9737V14.6248H87.4203V16.7528C87.992 16.0117 88.7225 15.4294 89.6118 15.0059C90.5223 14.5824 91.5175 14.3707 92.5974 14.3707C93.9737 14.3707 95.2018 14.6671 96.2816 15.26C97.3615 15.8317 98.1979 16.6575 98.7908 17.7374C99.3625 16.721 100.188 15.9058 101.268 15.2918C102.369 14.6777 103.555 14.3707 104.825 14.3707ZM132.294 23.0415C132.294 23.6767 132.252 24.2484 132.167 24.7566H119.304C119.41 26.027 119.854 27.0222 120.638 27.7421C121.421 28.4621 122.385 28.822 123.528 28.822C125.18 28.822 126.355 28.1127 127.053 26.694H131.849C131.341 28.3879 130.367 29.7854 128.927 30.8865C127.488 31.9664 125.72 32.5063 123.623 32.5063C121.929 32.5063 120.405 32.1358 119.05 31.3947C117.716 30.6324 116.668 29.5631 115.905 28.1868C115.164 26.8105 114.794 25.2224 114.794 23.4226C114.794 21.6017 115.164 20.003 115.905 18.6267C116.646 17.2504 117.684 16.1917 119.018 15.4506C120.352 14.7095 121.887 14.3389 123.623 14.3389C125.296 14.3389 126.789 14.6989 128.102 15.4188C129.436 16.1387 130.462 17.1657 131.182 18.4996C131.924 19.8124 132.294 21.3264 132.294 23.0415ZM127.689 21.771C127.668 20.6276 127.255 19.7172 126.45 19.0396C125.645 18.3408 124.661 17.9915 123.496 17.9915C122.395 17.9915 121.464 18.3303 120.701 19.0078C119.96 19.6642 119.505 20.5853 119.336 21.771H127.689ZM141.955 32.5063C140.516 32.5063 139.224 32.2522 138.081 31.744C136.937 31.2147 136.027 30.5054 135.349 29.616C134.693 28.7267 134.333 27.7421 134.269 26.6623H138.748C138.832 27.3398 139.16 27.9009 139.732 28.3456C140.325 28.7903 141.055 29.0126 141.924 29.0126C142.771 29.0126 143.427 28.8432 143.893 28.5044C144.38 28.1656 144.623 27.7316 144.623 27.2022C144.623 26.6305 144.327 26.207 143.734 25.9318C143.162 25.6353 142.241 25.3177 140.971
{ "end_byte": 5628, "start_byte": 2208, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg_5629_6611
24.9789C139.658 24.6613 138.578 24.3331 137.731 23.9943C136.905 23.6555 136.185 23.1368 135.571 22.438C134.979 21.7393 134.682 20.797 134.682 19.6113C134.682 18.6373 134.957 17.748 135.508 16.9434C136.08 16.1387 136.884 15.5035 137.922 15.0377C138.98 14.5719 140.219 14.3389 141.638 14.3389C143.734 14.3389 145.407 14.8683 146.656 15.927C147.905 16.9645 148.593 18.3726 148.721 20.1512H144.465C144.401 19.4525 144.105 18.902 143.575 18.4996C143.067 18.0762 142.379 17.8644 141.511 17.8644C140.706 17.8644 140.081 18.0126 139.637 18.3091C139.213 18.6055 139.002 19.0184 139.002 19.5478C139.002 20.1406 139.298 20.5959 139.891 20.9135C140.484 21.2099 141.405 21.517 142.654 21.8346C143.925 22.1522 144.973 22.4804 145.798 22.8192C146.624 23.1579 147.334 23.6873 147.926 24.4072C148.541 25.106 148.858 26.0376 148.879 27.2022C148.879 28.2186 148.593 29.129 148.022 29.9337C147.471 30.7383 146.667 31.3735 145.608 31.8393C144.57 32.284 143.353 32.5063 141.955 32.5063Z" fill="#605DC8"/>
{ "end_byte": 6611, "start_byte": 5629, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg_6612_6619
</svg>
{ "end_byte": 6619, "start_byte": 6612, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/08-ngFor/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/README.md_0_6374
# Hello world This first lesson serves as the starting point from which each lesson in this tutorial adds new features to build a complete Angular app. In this lesson, we'll update the application to display the famous text, "Hello World". <docs-video src="https://www.youtube.com/embed/UnOwDuliqZA?si=uML-cDRbrxmYdD_9"/> ## What you'll learn The updated app you have after this lesson confirms that you and your IDE are ready to begin creating an Angular app. Note: If you are working with the embedded editor, skip to [step three](#create-%60hello-world%60). When working in the browser playground, you do not need to `ng serve` to run the app. Other commands like `ng generate` can be done in the console window to your right. <docs-workflow> <docs-step title="Download the default app"> Start by clicking the "Download" icon in the top right pan of the code editor. This will download a `.zip` file containing the source code for this tutorial. Open this in your local Terminal and IDE then move on to testing the default app. At any step in the tutorial, you can click this icon to download the step's source code and start from there. </docs-step> <docs-step title="Test the default app"> In this step, after you download the default starting app, you build the default Angular app. This confirms that your development environment has what you need to continue the tutorial. In the **Terminal** pane of your IDE: 1. In your project directory, navigate to the `first-app` directory. 1. Run this command to install the dependencies needed to run the app. <docs-code language="shell"> npm install </docs-code> 1. Run this command to build and serve the default app. <docs-code language="shell"> ng serve </docs-code> The app should build without errors. 1. In a web browser on your development computer, open `http://localhost:4200`. 1. Confirm that the default web site appears in the browser. 1. You can leave `ng serve` running as you complete the next steps. </docs-step> <docs-step title="Review the files in the project"> In this step, you get to know the files that make up a default Angular app. In the **Explorer** pane of your IDE: 1. In your project directory, navigate to the `first-app` directory. 1. Open the `src` directory to see these files. 1. In the file explorer, find the Angular app files (`/src`). 1. `index.html` is the app's top level HTML template. 1. `styles.css` is the app's top level style sheet. 1. `main.ts` is where the app starts running. 1. `favicon.ico` is the app's icon, just as you would find in any web site. 1. In the file explorer, find the Angular app's component files (`/app`). 1. `app.component.ts` is the source file that describes the `app-root` component. This is the top-level Angular component in the app. A component is the basic building block of an Angular application. The component description includes the component's code, HTML template, and styles, which can be described in this file, or in separate files. In this app, the styles are in a separate file while the component's code and HTML template are in this file. 1. `app.component.css` is the style sheet for this component. 1. New components are added to this directory. 1. In the file explorer, find the image directory (`/assets`) that contains images used by the app. 1. In the file explorer, find the files and directories that an Angular app needs to build and run, but they are not files that you normally interact with. 1. `.angular` has files required to build the Angular app. 1. `.e2e` has files used to test the app. 1. `.node_modules` has the node.js packages that the app uses. 1. `angular.json` describes the Angular app to the app building tools. 1. `package.json` is used by `npm` (the node package manager) to run the finished app. 1. `tsconfig.*` are the files that describe the app's configuration to the TypeScript compiler. After you have reviewed the files that make up an Angular app project, continue to the next step. </docs-step> <docs-step title="Create `Hello World`"> In this step, you update the Angular project files to change the displayed content. In your IDE: 1. Open `first-app/src/index.html`. Note: This step and the next are only for your local environment! 1. In `index.html`, replace the `<title>` element with this code to update the title of the app. <docs-code header="Replace in src/index.html" path="adev/src/content/tutorials/first-app/steps/02-HomeComponent/src/index.html" visibleLines="[5]"/> Then, save the changes you just made to `index.html`. 1. Next, open `first-app/src/app/app.component.ts`. 1. In `app.component.ts`, in the `@Component` definition, replace the `template` line with this code to change the text in the app component. <docs-code header="Replace in src/app/app.component.ts" path="adev/src/content/tutorials/first-app/steps/02-HomeComponent/src/app/app.component.ts" visibleLines="[7,9]"/> 1. In `app.component.ts`, in the `AppComponent` class definition, replace the `title` line with this code to change the component title. <docs-code header="Replace in src/app/app.component.ts" path="adev/src/content/tutorials/first-app/steps/02-HomeComponent/src/app/app.component.ts" visibleLines="[12,14]"/> Then, save the changes you made to `app.component.ts`. 1. If you stopped the `ng serve` command from step 1, in the **Terminal** window of your IDE, run `ng serve` again. 1. Open your browser and navigate to `localhost:4200` and confirm that the app builds without error and displays *Hello world* in the title and body of your app: <img alt="browser frame of page displaying the text 'Hello World'" src="assets/images/tutorials/first-app/homes-app-lesson-01-browser.png"> </docs-step> </docs-workflow> Summary: In this lesson, you updated a default Angular app to display *Hello world*. In the process, you learned about the `ng serve` command to serve your app locally for testing. For more information about the topics covered in this lesson, visit: <docs-pill-row> <docs-pill href="guide/components" title="Angular Components"/> <docs-pill href="tools/cli" title="Creating applications with the Angular CLI"/> </docs-pill-row>
{ "end_byte": 6374, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/README.md" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/index.html_0_429
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Default</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 429, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/index.html" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/main.ts_0_420
/* * Protractor support is deprecated in Angular. * Protractor is used in this example for compatibility with Angular documentation tools. */ import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, {providers: [provideProtractorTestingSupport()]}).catch((err) => console.error(err), );
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/main.ts" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/styles.css_0_443
/* You can add global styles to this file, and also import other style files */ * { margin: 0; padding: 0; } body { font-family: 'Be Vietnam Pro', sans-serif; } :root { --primary-color: #605DC8; --secondary-color: #8B89E6; --accent-color: #e8e7fa; --shadow-color: #E8E8E8; } button.primary { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; }
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/styles.css" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/app/app.component.ts_0_246
import {Component} from '@angular/core'; @Component({ selector: 'app-root', standalone: true, imports: [], template: ` <h1>Default</h1> `, styleUrls: ['./app.component.css'], }) export class AppComponent { title = 'default'; }
{ "end_byte": 246, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/app/app.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/app/app.component.css_0_213
:host { --content-padding: 10px; } header { display: block; height: 60px; padding: var(--content-padding); box-shadow: 0px 5px 25px var(--shadow-color); } .content { padding: var(--content-padding); }
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/app/app.component.css" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/location-pin.svg_0_502
<?xml version="1.0" encoding="UTF-8"?> <svg width="20pt" height="20pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 11.602c-15.398 0-27.898 12.5-27.898 27.898 0 5 1.3008 9.6992 3.6016 13.801l2.8984 4.1992 21.398 30.898 21.801-31.398 2.1992-3.1992c2.5-4.1992 3.8984-9 3.8984-14.199 0-15.5-12.5-28-27.898-28zm0 35.598c-4.1992 0-7.6992-3.3984-7.6992-7.6992s3.3984-7.6992 7.6992-7.6992 7.6992 3.3984 7.6992 7.6992-3.5 7.6992-7.6992 7.6992z" fill="#605cc8"/> </svg>
{ "end_byte": 502, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/location-pin.svg" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg_0_2207
<svg width="151" height="44" viewBox="0 0 151 44" fill="none" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" clip-rule="evenodd" d="M6.15532 33.2946C5.25369 33.2946 4.58006 32.5707 4.58006 31.6701V24.0152C4.58006 19.5469 4.35206 20.6276 7.59585 17.4236C21.7317 4.06732 16.2425 4.24744 29.6149 18.054C32.0434 20.7627 31.9985 19.4534 31.9985 23.8316V31.6667C31.9985 32.5707 31.28 33.2912 30.3749 33.2912H6.15532V33.2946Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M30.896 35.1547L5.73676 35.2586C4.80059 35.2621 3.75042 35.8232 3.37388 36.5229L2.90061 37.4027L0.537726 41.7878L0.140457 42.529C-0.236085 43.2253 0.164639 43.7829 1.10081 43.7795L26.26 43.6756C27.1962 43.6721 28.2464 43.111 28.6229 42.4113L29.0962 41.5315L31.4591 37.1463L31.8563 36.4051C32.2329 35.7089 31.8321 35.1512 30.896 35.1547Z" fill="#605DC8"/> <path d="M2.54861 18.7156C2.23079 18.7156 1.90952 18.629 1.6228 18.4454C0.821352 17.9363 0.5899 16.859 1.09771 16.0554C1.46389 15.4701 2.70061 14.2231 5.50912 11.4659L6.39693 10.5931C8.73218 8.38318 10.5147 6.56817 11.9449 5.10646C15.1679 1.81587 16.7985 0.153263 18.9023 0.222538C20.9888 0.277958 22.4362 1.92325 25.3138 5.19651C26.7267 6.8037 28.4816 8.8023 30.8514 11.2477C30.8652 11.265 30.8825 11.2789 30.8963 11.2962C31.228 11.6634 31.715 12.2003 32.2401 12.7752C33.9743 14.6734 34.8206 15.6086 35.0763 15.9688C35.629 16.7413 35.4494 17.8185 34.679 18.3727C33.9087 18.9234 32.8343 18.7468 32.2816 17.9744C32.0639 17.6869 30.5889 16.0693 29.708 15.1064C29.1863 14.5348 28.6993 14.0014 28.3642 13.6308C25.9495 11.1369 24.1704 9.11057 22.7368 7.4826C21.0233 5.5325 19.4032 3.68977 18.809 3.67245H18.8021C18.1699 3.67245 16.3356 5.54289 14.3976 7.52417C12.9467 9.00666 11.14 10.8494 8.78054 13.0766L7.91001 13.9321C6.74929 15.0717 4.33804 17.4375 3.97877 17.9293C3.65405 18.4454 3.10824 18.7225 2.54515 18.7225L2.54861 18.7156Z" fill="#605DC8"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M22.0976 33.2115V26.0588C22.0976 25.4665 21.6174 24.985 21.0267 24.985H15.1955C14.6047 24.985 14.1246 25.4665 14.1246 26.0588V33.2115C14.1246 33.2704 14.1142 33.3293 14.0969 33.3847H22.1252C22.1079 33.3293 22.0976 33.2739 22.0976 33.2115Z" fill="white"/>
{ "end_byte": 2207, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg_2208_5628
<path d="M58.9784 10.0512V32.2205H54.5319V22.7874H45.0353V32.2205H40.5887V10.0512H45.0353V19.1666H54.5319V10.0512H58.9784ZM70.8506 32.5063C69.1567 32.5063 67.6322 32.1358 66.277 31.3947C64.9219 30.6324 63.8526 29.5631 63.0692 28.1868C62.3069 26.8105 61.9258 25.2224 61.9258 23.4226C61.9258 21.6228 62.3175 20.0348 63.1009 18.6585C63.9055 17.2821 64.996 16.2234 66.3723 15.4823C67.7486 14.7201 69.2838 14.3389 70.9777 14.3389C72.6716 14.3389 74.2067 14.7201 75.5831 15.4823C76.9594 16.2234 78.0393 17.2821 78.8227 18.6585C79.6273 20.0348 80.0296 21.6228 80.0296 23.4226C80.0296 25.2224 79.6167 26.8105 78.7909 28.1868C77.9863 29.5631 76.8853 30.6324 75.4878 31.3947C74.1115 32.1358 72.5657 32.5063 70.8506 32.5063ZM70.8506 28.6315C71.6553 28.6315 72.4069 28.4409 73.1057 28.0597C73.8256 27.6574 74.3973 27.0646 74.8208 26.2811C75.2443 25.4977 75.456 24.5449 75.456 23.4226C75.456 21.7499 75.0114 20.4688 74.122 19.5795C73.2539 18.669 72.1846 18.2138 70.9142 18.2138C69.6437 18.2138 68.5744 18.669 67.7063 19.5795C66.8593 20.4688 66.4358 21.7499 66.4358 23.4226C66.4358 25.0954 66.8487 26.387 67.6745 27.2975C68.5215 28.1868 69.5802 28.6315 70.8506 28.6315ZM104.825 14.3707C106.985 14.3707 108.721 15.0377 110.034 16.3717C111.368 17.6844 112.035 19.5266 112.035 21.8981V32.2205H107.589V22.5016C107.589 21.1252 107.239 20.0771 106.54 19.3572C105.842 18.6161 104.889 18.2456 103.682 18.2456C102.475 18.2456 101.512 18.6161 100.792 19.3572C100.093 20.0771 99.7436 21.1252 99.7436 22.5016V32.2205H95.297V22.5016C95.297 21.1252 94.9477 20.0771 94.2489 19.3572C93.5502 18.6161 92.5974 18.2456 91.3904 18.2456C90.1623 18.2456 89.1883 18.6161 88.4684 19.3572C87.7697 20.0771 87.4203 21.1252 87.4203 22.5016V32.2205H82.9737V14.6248H87.4203V16.7528C87.992 16.0117 88.7225 15.4294 89.6118 15.0059C90.5223 14.5824 91.5175 14.3707 92.5974 14.3707C93.9737 14.3707 95.2018 14.6671 96.2816 15.26C97.3615 15.8317 98.1979 16.6575 98.7908 17.7374C99.3625 16.721 100.188 15.9058 101.268 15.2918C102.369 14.6777 103.555 14.3707 104.825 14.3707ZM132.294 23.0415C132.294 23.6767 132.252 24.2484 132.167 24.7566H119.304C119.41 26.027 119.854 27.0222 120.638 27.7421C121.421 28.4621 122.385 28.822 123.528 28.822C125.18 28.822 126.355 28.1127 127.053 26.694H131.849C131.341 28.3879 130.367 29.7854 128.927 30.8865C127.488 31.9664 125.72 32.5063 123.623 32.5063C121.929 32.5063 120.405 32.1358 119.05 31.3947C117.716 30.6324 116.668 29.5631 115.905 28.1868C115.164 26.8105 114.794 25.2224 114.794 23.4226C114.794 21.6017 115.164 20.003 115.905 18.6267C116.646 17.2504 117.684 16.1917 119.018 15.4506C120.352 14.7095 121.887 14.3389 123.623 14.3389C125.296 14.3389 126.789 14.6989 128.102 15.4188C129.436 16.1387 130.462 17.1657 131.182 18.4996C131.924 19.8124 132.294 21.3264 132.294 23.0415ZM127.689 21.771C127.668 20.6276 127.255 19.7172 126.45 19.0396C125.645 18.3408 124.661 17.9915 123.496 17.9915C122.395 17.9915 121.464 18.3303 120.701 19.0078C119.96 19.6642 119.505 20.5853 119.336 21.771H127.689ZM141.955 32.5063C140.516 32.5063 139.224 32.2522 138.081 31.744C136.937 31.2147 136.027 30.5054 135.349 29.616C134.693 28.7267 134.333 27.7421 134.269 26.6623H138.748C138.832 27.3398 139.16 27.9009 139.732 28.3456C140.325 28.7903 141.055 29.0126 141.924 29.0126C142.771 29.0126 143.427 28.8432 143.893 28.5044C144.38 28.1656 144.623 27.7316 144.623 27.2022C144.623 26.6305 144.327 26.207 143.734 25.9318C143.162 25.6353 142.241 25.3177 140.971
{ "end_byte": 5628, "start_byte": 2208, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg_5629_6611
24.9789C139.658 24.6613 138.578 24.3331 137.731 23.9943C136.905 23.6555 136.185 23.1368 135.571 22.438C134.979 21.7393 134.682 20.797 134.682 19.6113C134.682 18.6373 134.957 17.748 135.508 16.9434C136.08 16.1387 136.884 15.5035 137.922 15.0377C138.98 14.5719 140.219 14.3389 141.638 14.3389C143.734 14.3389 145.407 14.8683 146.656 15.927C147.905 16.9645 148.593 18.3726 148.721 20.1512H144.465C144.401 19.4525 144.105 18.902 143.575 18.4996C143.067 18.0762 142.379 17.8644 141.511 17.8644C140.706 17.8644 140.081 18.0126 139.637 18.3091C139.213 18.6055 139.002 19.0184 139.002 19.5478C139.002 20.1406 139.298 20.5959 139.891 20.9135C140.484 21.2099 141.405 21.517 142.654 21.8346C143.925 22.1522 144.973 22.4804 145.798 22.8192C146.624 23.1579 147.334 23.6873 147.926 24.4072C148.541 25.106 148.858 26.0376 148.879 27.2022C148.879 28.2186 148.593 29.129 148.022 29.9337C147.471 30.7383 146.667 31.3735 145.608 31.8393C144.57 32.284 143.353 32.5063 141.955 32.5063Z" fill="#605DC8"/>
{ "end_byte": 6611, "start_byte": 5629, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg_6612_6619
</svg>
{ "end_byte": 6619, "start_byte": 6612, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/01-hello-world/src/assets/logo.svg" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/README.md_0_2965
# Add an interpolation to a component’s template This tutorial lesson demonstrates how to add interpolation to Angular templates in order to display dynamic data in a template. <docs-video src="https://www.youtube.com/embed/eM3zi_n7lNs?si=IFAly3Ss8dwqFx8N&amp;start=338"/> ## What you'll learn - Your app will display interpolated values in the `HousingLocationComponent` template. - Your app will render a housing location data to the browser. ## Conceptual preview of interpolation In this step you will display values (properties and `Input` values) in a template using interpolation. Using the `{{ expression }}` in Angular templates, you can render values from properties, `Inputs` and valid JavaScript expressions. For a more in depth explanation, please refer to the [Displaying values with interpolation](guide/templates/binding#render-dynamic-text-with-text-interpolation) guide. <docs-workflow> <docs-step title="Update `HousingLocationComponent` template to include interpolated values"> This step adds new HTML structure and interpolated values in the `HousingLocationComponent` template. In the code editor: 1. Navigate to `src/app/housing-location/housing-location.component.ts` 1. In the template property of the `@Component` decorator, replace the existing HTML markup with the following code: <docs-code header="Update HousingLocationComponent template" path="adev/src/content/tutorials/first-app/steps/08-ngFor/src/app/housing-location/housing-location.component.ts" visibleLines="[9,20]"/> In this updated template code you have used property binding to bind the `housingLocation.photo` to the `src` attribute. The `alt` attribute uses interpolation to give more context to the alt text of the image. You use interpolation to include the values for `name`, `city` and `state` of the `housingLocation` property. </docs-step> <docs-step title="Confirm the changes render in the browser"> 1. Save all changes. 1. Open the browser and confirm that the app renders the photo, city and state sample data. <img alt="browser frame of homes-app displaying logo, filter text input box, search button and the same housing location UI card" src="assets/images/tutorials/first-app/homes-app-lesson-07-step-2.png"> </docs-step> </docs-workflow> Summary: In this lesson, you added a new HTML structure and used Angular template syntax to render values in the `HousingLocation` template. Now, you have two important skills: - passing data to components - Interpolating values into a template With these skills, your app can now share data and display dynamic values in the browser. Great work so far. For more information about the topics covered in this lesson, visit: <docs-pill-row> <docs-pill href="guide/templates" title="Template syntax"/> <docs-pill href="guide/templates/binding#render-dynamic-text-with-text-interpolation" title="Displaying values with interpolation"/> </docs-pill-row>
{ "end_byte": 2965, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/README.md" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/index.html_0_427
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Homes</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> <link href="https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,400;0,700;1,400;1,700&display=swap" rel="stylesheet"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 427, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/index.html" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/main.ts_0_420
/* * Protractor support is deprecated in Angular. * Protractor is used in this example for compatibility with Angular documentation tools. */ import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, {providers: [provideProtractorTestingSupport()]}).catch((err) => console.error(err), );
{ "end_byte": 420, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/main.ts" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/styles.css_0_443
/* You can add global styles to this file, and also import other style files */ * { margin: 0; padding: 0; } body { font-family: 'Be Vietnam Pro', sans-serif; } :root { --primary-color: #605DC8; --secondary-color: #8B89E6; --accent-color: #e8e7fa; --shadow-color: #E8E8E8; } button.primary { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; }
{ "end_byte": 443, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/styles.css" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/housinglocation.ts_0_180
export interface HousingLocation { id: number; name: string; city: string; state: string; photo: string; availableUnits: number; wifi: boolean; laundry: boolean; }
{ "end_byte": 180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/housinglocation.ts" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/app.component.ts_0_529
import {Component} from '@angular/core'; import {HomeComponent} from './home/home.component'; @Component({ selector: 'app-root', standalone: true, imports: [HomeComponent], template: ` <main> <header class="brand-name"> <img class="brand-logo" src="/assets/logo.svg" alt="logo" aria-hidden="true" /> </header> <section class="content"> <app-home></app-home> </section> </main> `, styleUrls: ['./app.component.css'], }) export class AppComponent { title = 'homes'; }
{ "end_byte": 529, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/app.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/app.component.css_0_213
:host { --content-padding: 10px; } header { display: block; height: 60px; padding: var(--content-padding); box-shadow: 0px 5px 25px var(--shadow-color); } .content { padding: var(--content-padding); }
{ "end_byte": 213, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/app.component.css" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/home/home.component.ts_0_1046
import {Component} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocationComponent} from '../housing-location/housing-location.component'; import {HousingLocation} from '../housinglocation'; @Component({ selector: 'app-home', standalone: true, imports: [CommonModule, HousingLocationComponent], template: ` <section> <form> <input type="text" placeholder="Filter by city" /> <button class="primary" type="button">Search</button> </form> </section> <section class="results"> <app-housing-location [housingLocation]="housingLocation"></app-housing-location> </section> `, styleUrls: ['./home.component.css'], }) export class HomeComponent { readonly baseUrl = 'https://angular.dev/assets/images/tutorials/common'; housingLocation: HousingLocation = { id: 9999, name: 'Test Home', city: 'Test city', state: 'ST', photo: `${this.baseUrl}/example-house.jpg`, availableUnits: 99, wifi: true, laundry: false, }; }
{ "end_byte": 1046, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/home/home.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/home/home.component.css_0_746
.results { display: grid; column-gap: 14px; row-gap: 14px; grid-template-columns: repeat(auto-fill, minmax(400px, 400px)); margin-top: 50px; justify-content: space-around; } input[type="text"] { border: solid 1px var(--primary-color); padding: 10px; border-radius: 8px; margin-right: 4px; display: inline-block; width: 30%; } button { padding: 10px; border: solid 1px var(--primary-color); background: var(--primary-color); color: white; border-radius: 8px; } @media (min-width: 500px) and (max-width: 768px) { .results { grid-template-columns: repeat(2, 1fr); } input[type="text"] { width: 70%; } } @media (max-width: 499px) { .results { grid-template-columns: 1fr; } }
{ "end_byte": 746, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/home/home.component.css" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/housing-location/housing-location.component.css_0_583
.listing { background: var(--accent-color); border-radius: 30px; padding-bottom: 30px; } .listing-heading { color: var(--primary-color); padding: 10px 20px 0 20px; } .listing-photo { height: 250px; width: 100%; object-fit: cover; border-radius: 30px 30px 0 0; } .listing-location { padding: 10px 20px 20px 20px; } .listing-location::before { content: url("/assets/location-pin.svg") / ""; } section.listing a { padding-left: 20px; text-decoration: none; color: var(--primary-color); } section.listing a::after { content: "\203A"; margin-left: 5px; }
{ "end_byte": 583, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/housing-location/housing-location.component.css" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/housing-location/housing-location.component.ts_0_439
import {Component, Input} from '@angular/core'; import {CommonModule} from '@angular/common'; import {HousingLocation} from '../housinglocation'; @Component({ selector: 'app-housing-location', standalone: true, imports: [CommonModule], template: ` <p>housing-location works!</p> `, styleUrls: ['./housing-location.component.css'], }) export class HousingLocationComponent { @Input() housingLocation!: HousingLocation; }
{ "end_byte": 439, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/app/housing-location/housing-location.component.ts" }
angular/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/assets/location-pin.svg_0_502
<?xml version="1.0" encoding="UTF-8"?> <svg width="20pt" height="20pt" version="1.1" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 11.602c-15.398 0-27.898 12.5-27.898 27.898 0 5 1.3008 9.6992 3.6016 13.801l2.8984 4.1992 21.398 30.898 21.801-31.398 2.1992-3.1992c2.5-4.1992 3.8984-9 3.8984-14.199 0-15.5-12.5-28-27.898-28zm0 35.598c-4.1992 0-7.6992-3.3984-7.6992-7.6992s3.3984-7.6992 7.6992-7.6992 7.6992 3.3984 7.6992 7.6992-3.5 7.6992-7.6992 7.6992z" fill="#605cc8"/> </svg>
{ "end_byte": 502, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/tutorials/first-app/steps/07-dynamic-template-values/src/assets/location-pin.svg" }