import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import {HttpClientModule} from '@angular/common/http'
import {Routes, RouterModule} from '@angular/router';
import { AppComponent } from './app.component';
import { PropertyCardComponent } from './property/property-card/property-card.component';
import { PropertyListComponent } from './property/property-list/property-list.component';
import { NavBarComponent } from './nav-bar/nav-bar.component';
import { HousingService } from './services/housing.service';
import { AddPropertyComponent } from './property/add-property/add-property.component';
import { PropertyDetailComponent } from './property/property-detail/property-detail.component';
const appRoutes: Routes = [
{path:'', component: PropertyListComponent},
{path:'rent-property', component: PropertyListComponent},
{path:'add-property', component: AddPropertyComponent},
{path:'property-detail/:id', component: PropertyDetailComponent}
]
@NgModule({
declarations: [
AppComponent,
PropertyCardComponent,
PropertyListComponent,
NavBarComponent,
AddPropertyComponent,
PropertyDetailComponent
],
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
RouterModule.forRoot(appRoutes)
],
providers: [
HousingService
],
bootstrap: [AppComponent]
})
export class AppModule { }
then, in the html component I have this code:
<div class="card">
<div class="card-img-wrapper">
<img class="card-img-top" src="assets/images/house_default.png" />
<ul class="list-inline text-center member-icons animate">
<li class="list-inline-item">
<button class="btn btn-primary" routerLink="/property-detail/{{property.Id}}"><i class="fa-solid fa-pen-to-square"></i></button>
</li>
<li class="list-inline-item">
<button class="btn btn-primary"><i class="fa-solid fa-address-book"></i></button>
</li>
</ul>
</div>
<div class="card-body p-2">
<h1>{{ property.Name }}</h1>
<h2>{{ property.Type }}</h2>
<h3>{{ property.Price }}</h3>
</div>
</div>