Added Models
This commit is contained in:
parent
6e54a7b3aa
commit
9e53885330
@ -1,3 +1,9 @@
|
||||
<h1>Welcome to {{title}}!</h1>
|
||||
<i class="fa-brands fa-airbnb"></i>
|
||||
<h2>test</h2>
|
||||
<app-nav-bar></app-nav-bar>
|
||||
<div class="container" style="margin-top: 140px;">
|
||||
<h1>Welcome to {{title}}</h1>
|
||||
<ul>
|
||||
<li class="list-unstyled" *ngFor="let product of products">
|
||||
{{product.name}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
@ -1,10 +1,26 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { IPagination } from './models/pagination';
|
||||
import { IProduct } from './models/product';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
export class AppComponent {
|
||||
export class AppComponent implements OnInit {
|
||||
title = 'E-Commerce';
|
||||
}
|
||||
products: IProduct[];
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.http.get('https://localhost:5001/api/products?pageSize=50').subscribe(
|
||||
{
|
||||
next: (response: IPagination) => { this.products = response.data; },
|
||||
error: (e: any) => { console.log(e); },
|
||||
complete: () => { console.log('complete'); }
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -1,18 +1,22 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NavBarComponent } from './nav-bar/nav-bar.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
AppComponent,
|
||||
NavBarComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
BrowserAnimationsModule,
|
||||
HttpClientModule
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
|
8
client/src/app/models/pagination.ts
Normal file
8
client/src/app/models/pagination.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { IProduct } from "./product"
|
||||
|
||||
export interface IPagination {
|
||||
pageIndex: number
|
||||
pageSize: number
|
||||
count: number
|
||||
data: IProduct[]
|
||||
}
|
9
client/src/app/models/product.ts
Normal file
9
client/src/app/models/product.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export interface IProduct {
|
||||
id: number
|
||||
name: string
|
||||
description: string
|
||||
price: number
|
||||
pictureUrl: string
|
||||
productType: string
|
||||
productBrand: string
|
||||
}
|
17
client/src/app/nav-bar/nav-bar.component.html
Normal file
17
client/src/app/nav-bar/nav-bar.component.html
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="d-flex flex-column flex-md-row align-items-center justify-content-between p-3 px-md-4 mb-3 bg-white border-bottom shadown-sm fixed-top">
|
||||
<img src="/assets/images/logo.png" style="max-height: 70px;" alt="logo">
|
||||
<nav class="me-3 my-md-0 mr-md-3 text-uppercase" style="font-size: larger;">
|
||||
<a class="me-3 py-2 text-dark" href="#">Home</a>
|
||||
<a class="me-3 py-2 text-dark" href="#">Shop</a>
|
||||
<a class="me-3 py-2 text-dark" href="#">Contact</a>
|
||||
</nav>
|
||||
<div class="d-flex align-items-center">
|
||||
<a class="position-relative">
|
||||
<i class="fa fa-shopping-cart fa-2x me-3 text-dark"></i>
|
||||
<div class="cart-no">5</div>
|
||||
</a>
|
||||
<a class="btn btn-outline-secondary me-3" href="#">Login</a>
|
||||
<a class="btn btn-outline-secondary me-3" href="#">Sign up</a>
|
||||
</div>
|
||||
|
||||
</div>
|
12
client/src/app/nav-bar/nav-bar.component.scss
Normal file
12
client/src/app/nav-bar/nav-bar.component.scss
Normal file
@ -0,0 +1,12 @@
|
||||
.cart-no {
|
||||
position: absolute;
|
||||
min-height: 25px;
|
||||
min-width: 25px;
|
||||
border-radius: 50%;
|
||||
font-size: 1em;
|
||||
background: blue;
|
||||
color: white;
|
||||
text-align: center;
|
||||
top: -12px;
|
||||
right: 5px;
|
||||
}
|
15
client/src/app/nav-bar/nav-bar.component.ts
Normal file
15
client/src/app/nav-bar/nav-bar.component.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-nav-bar',
|
||||
templateUrl: './nav-bar.component.html',
|
||||
styleUrls: ['./nav-bar.component.scss']
|
||||
})
|
||||
export class NavBarComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
BIN
client/src/assets/images/hero1.jpg
Normal file
BIN
client/src/assets/images/hero1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
BIN
client/src/assets/images/hero2.jpg
Normal file
BIN
client/src/assets/images/hero2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
BIN
client/src/assets/images/hero3.jpg
Normal file
BIN
client/src/assets/images/hero3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
BIN
client/src/assets/images/logo.png
Normal file
BIN
client/src/assets/images/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
BIN
client/src/assets/images/placeholder.png
Normal file
BIN
client/src/assets/images/placeholder.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
Loading…
Reference in New Issue
Block a user