Issue
I have an error message:
Type '{ quantity: number; }' is not assignable to type
'Partial<EditOrderConfirmModalComponent>'.
Object literal may only specify known properties, and
'quantity' does not exist in type 'Partial<EditOrderConfirmModalComponent>'.
I don't understand where is the problem?
The method is like this:
open(): void {
const modalRef = this.modalService.show(EditOrderConfirmModalComponent, {
...NOT_CLOSABLE_MODAL_OPTIONS,
initialState: {
quantity: this.order!.quantity
}
});
modalRef.content!.closeModal.pipe(
takeUntil(this.unsubscribe$)
).subscribe(() => {
modalRef?.hide();
});
}
In the EditOrderConfirmModalComponent
I have this:
export class EditOrderConfirmModalComponent implements OnInit {
modalService: any;
private unsubscribe$ = new Subject < void > ();
@Output() closeModal = new EventEmitter < void > ();
@Input() orderToEdit ? : Order;
constructor(
public modal: BsModalRef,
private router: Router,
private location: Location,
private service: EditOrderService
) {}
For HTML
<td style="min-width: 100%"> {{ orderToEdit.quantity }}</td>
Thank you for your time.
Solution
your initial state doesn't match the interface of the component. you probably mean to do:
const modalRef = this.modalService.show(EditOrderConfirmModalComponent, {
...NOT_CLOSABLE_MODAL_OPTIONS,
initialState: {
orderToEdit: { quantity: this.order!.quantity }
}
});
Answered By - bryan60
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.