Created
May 5, 2017 06:07
-
-
Save openopen114/6952c6a23137fbb50c39581f62758d9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // in html | |
| <form #userform = "ngForm" (ngSubmit) = "onSubmit(userform.value)"> | |
| <input name="first" ngModel required #first="ngModel"> | |
| <input type="text" placeholder="lastname" name="lastname" ngModel> | |
| <select name="lang" ngModel> | |
| <option value="a1">a1</option> | |
| <option value="a2">a2</option> | |
| <option value="a3">a3</option> | |
| </select> | |
| <input type="submit" value="submit"> | |
| </form> | |
| <p>First name value: {{ first.value }}</p> | |
| // in module.ts | |
| onSubmit = function(user){ | |
| console.log(user); | |
| console.log(user.first); | |
| console.log(user.lastname); | |
| console.log(user.lang); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment