puddlejumper26 / blogs

Personal Tech Blogs
4 stars 1 forks source link

Obtain value inside input of Angular #170

Open puddlejumper26 opened 4 years ago

puddlejumper26 commented 4 years ago

Method 1

buttonFn(){ console.log(this.username) }


# Method 2
- use **`# variable`**
```html
<input type='text' #input1>
<button (click)='buttonFn(input1.value, $event)'>Click</button>  ==> $event will pass the entire object
buttonFn(inputValue, event){
 console.log(inputValue, event)
}