I am trying to get the ngModel value when it is un-touched, pristine on OnInit, all I am trying to achieve is when I do a request.GET and bind that value to ngModel to catch it in the directive while is un-touched.
for example:
<label for="employeeShare">Arbeitnehmer Anteil</label> <span class="requirered">*</span>
<input type="number" class="form-control" id="employeeShare" required placeholder="5.125%"
***toPercentage***
name="employeeShare"
[ngModel]="data.insObj.stat['AHV,IV,EO']?.employeeShare"
(ngModelChange)="data.insObj.stat['AHV,IV,EO'] && data.insObj.stat['AHV,IV,EO'].employeeShare = $event">
<i class="form-control-feedback">%</i>
this is my Input field, and my directive is called toPercentage.
I am trying to get the value of this ngModel in the directive while is still un-touched, pristine onInit or whatever lyfecicle I could get this value. how can I achieve this
for example:
ngOnInit() {
console.log(this.el.nativeElement.value);
this.el.nativeElement.value * 100
}
onInputChange(event) {
console.log(this.el.nativeElement.value);
this.el.nativeElement.value / 100
}