looking for some solutions? You are welcome.

SOLVED: angular 2 formControlName directive

ankur ratra:

I have a scenario where i have a custom directive on the input element which listens on the focus event on that input and store that elementRef in one service.

        <textarea mdInput formControlName="content"
                  [readonly]="!editable" mdTextareaAutosize 

Basically i want to track the last focused input element.

Now i have another sidebar showing the list of items. Now when i click on that item then the last focused input element value should be appended with the item value.

now in my component when i update the value like this.

this.renderer.setProperty(this.lastFocusedElementRef.nativeElement, 'value', newValue);

but with this the form model is not updated. formControlName directive is not updating the model from the input value.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

No comments: