Skip to content

Commit a5797f2

Browse files
committed
feat: add cart count interactions
1 parent 00c5ec7 commit a5797f2

16 files changed

+267
-8
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"prefix": "app",
3232
"style": "camelCase"
3333
}
34-
]
34+
],
35+
"rxjs/no-subject-value": [0]
3536
}
3637
},
3738
{

src/app/app-routing.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const routes: Routes = [
77
path: '',
88
component: ProductsComponent,
99
},
10+
{
11+
path: 'cart',
12+
loadChildren: () => import('./cart/cart.module').then((m) => m.CartModule),
13+
},
1014
];
1115

1216
@NgModule({

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { MatMenuModule } from '@angular/material/menu';
1212
import { MatTooltipModule } from '@angular/material/tooltip';
1313
import { ProductsModule } from './products/products.module';
1414
import { HttpClientModule } from '@angular/common/http';
15+
import { MatBadgeModule } from '@angular/material/badge';
1516

1617
@NgModule({
1718
declarations: [AppComponent, HeaderComponent],
@@ -26,6 +27,7 @@ import { HttpClientModule } from '@angular/common/http';
2627
MatTooltipModule,
2728
ProductsModule,
2829
HttpClientModule,
30+
MatBadgeModule,
2931
],
3032
providers: [],
3133
bootstrap: [AppComponent],

src/app/cart/cart-routing.module.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { RouterModule, Routes } from '@angular/router';
2+
import { NgModule } from '@angular/core';
3+
import { CartComponent } from './cart.component';
4+
5+
const routes: Routes = [
6+
{
7+
path: '',
8+
component: CartComponent,
9+
},
10+
];
11+
12+
@NgModule({
13+
imports: [RouterModule.forChild(routes)],
14+
exports: [RouterModule],
15+
})
16+
export class CartRoutingModule {}

src/app/cart/cart.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>cart works!</p>

src/app/cart/cart.component.scss

Whitespace-only changes.

src/app/cart/cart.component.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { CartComponent } from './cart.component';
4+
5+
describe('CartComponent', () => {
6+
let component: CartComponent;
7+
let fixture: ComponentFixture<CartComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [CartComponent],
12+
}).compileComponents();
13+
});
14+
15+
beforeEach(() => {
16+
fixture = TestBed.createComponent(CartComponent);
17+
component = fixture.componentInstance;
18+
fixture.detectChanges();
19+
});
20+
21+
it('should create', () => {
22+
expect(component).toBeTruthy();
23+
});
24+
});

src/app/cart/cart.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-cart',
5+
templateUrl: './cart.component.html',
6+
styleUrls: ['./cart.component.scss'],
7+
})
8+
export class CartComponent implements OnInit {
9+
constructor() {}
10+
11+
ngOnInit(): void {}
12+
}

src/app/cart/cart.module.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
import { CartComponent } from './cart.component';
4+
import { CartRoutingModule } from './cart-routing.module';
5+
6+
@NgModule({
7+
declarations: [CartComponent],
8+
imports: [CommonModule, CartRoutingModule],
9+
exports: [CartComponent],
10+
})
11+
export class CartModule {}

src/app/cart/cart.service.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestBed } from '@angular/core/testing';
2+
3+
import { CartService } from './cart.service';
4+
5+
describe('CartService', () => {
6+
let service: CartService;
7+
8+
beforeEach(() => {
9+
TestBed.configureTestingModule({});
10+
service = TestBed.inject(CartService);
11+
});
12+
13+
it('should be created', () => {
14+
expect(service).toBeTruthy();
15+
});
16+
});

0 commit comments

Comments
 (0)