3

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.

1
  • What material framework are you using ? Commented Aug 7, 2016 at 15:43

1 Answer 1

5

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';

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.