directive change ngmodel input value from contexmenu

64 Views Asked by At

i create a directive that display a custom context menu and when i select an item , the value binds to the input, the problem is that value is displayed but the ([ngModel]) not changed and after save nothing is updated. so how can i change the ngModel? thank you

1

There are 1 best solutions below

0
On

the one way that worked for me is :

const ctrl = this.ngControl.control;
ctrl.setValue(this.elementRef.nativeElement.value);