Updated to angular 11
Now compiling with strict mode in typescript Need to error checking now
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user