Reputation: 24492
Assumign I have the following template expression:
<md-input type="number" #power [placeholder]="powerLabel" required>
</md-input>
I want to access power.value
from my component .ts file, how I can do that?
Using ([ngModel]) gave me some console errors I couldn't manage to handle.
Upvotes: 3
Views: 5617
Reputation: 161
Not sure if it will work but have you tried creating a member variable using ViewChild like this: @ViewChild('power') power;
Then you can handle the value using this.power.nativeElement.value
Remember to import ViewChild: import {ViewChild} from '@angular/core';
Upvotes: 5