Updated to angular 11

Now compiling with strict mode in typescript
Need to error checking now
This commit is contained in:
2020-11-22 10:13:37 +05:30
parent cabd6f2ea1
commit 6567f560ab
187 changed files with 1709 additions and 1184 deletions

View File

@ -12,7 +12,7 @@ export class ProductsResolver implements Resolve<Product[]> {
constructor(private ser: ProductService, private router: Router) {}
resolve(route: ActivatedRouteSnapshot): Observable<Product[]> {
const id = route.paramMap.get('id');
const id = route.paramMap.get('id') as string;
return this.ser.listIsActiveOfCategory(id);
}
}

View File

@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ProductsComponent } from './products.component';
@ -6,11 +6,13 @@ describe('ProductsComponent', () => {
let component: ProductsComponent;
let fixture: ComponentFixture<ProductsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ProductsComponent],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ProductsComponent],
}).compileComponents();
}),
);
beforeEach(() => {
fixture = TestBed.createComponent(ProductsComponent);

View File

@ -10,12 +10,13 @@ import { BillService } from '../bill.service';
styleUrls: ['./products.component.css'],
})
export class ProductsComponent implements OnInit {
list: Product[];
list: Product[] = [];
constructor(private route: ActivatedRoute, private bs: BillService) {}
ngOnInit() {
this.route.data.subscribe((data: { list: Product[] }) => {
this.route.data.subscribe((value) => {
const data = value as { list: Product[] };
this.list = data.list;
});
}