Strict done!!
This commit is contained in:
+2
-2
@@ -14,7 +14,7 @@ import { ProductGroupService } from '../product-group.service';
|
||||
export class ProductGroupDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
item: ProductGroup;
|
||||
item: ProductGroup = new ProductGroup();
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
@@ -45,7 +45,7 @@ export class ProductGroupDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
this.nameElement.nativeElement.focus();
|
||||
if (this.nameElement) this.nameElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,6 @@ export class ProductGroupListDataSource extends DataSource<ProductGroup> {
|
||||
switch (sort.active) {
|
||||
case 'name':
|
||||
return compare(a.name, b.name, isAsc);
|
||||
case 'id':
|
||||
return compare(+a.id, +b.id, isAsc);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ import { ProductGroupListDataSource } from './product-group-list-datasource';
|
||||
export class ProductGroupListComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
dataSource: ProductGroupListDataSource;
|
||||
list: ProductGroup[];
|
||||
list: ProductGroup[] = [];
|
||||
dataSource: ProductGroupListDataSource = new ProductGroupListDataSource(this.list);
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'isFixture'];
|
||||
|
||||
@@ -28,6 +28,6 @@ export class ProductGroupListComponent implements OnInit {
|
||||
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new ProductGroupListDataSource(this.paginator, this.sort, this.list);
|
||||
this.dataSource = new ProductGroupListDataSource(this.list, this.paginator, this.sort);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const serviceName = 'ProductGroupService';
|
||||
export class ProductGroupService {
|
||||
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
|
||||
|
||||
get(id: string): Observable<ProductGroup> {
|
||||
get(id: string | null): Observable<ProductGroup> {
|
||||
const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
|
||||
return <Observable<ProductGroup>>(
|
||||
this.http
|
||||
|
||||
Reference in New Issue
Block a user