Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <form #testForm="ngForm">
  2. Email Address:
  3. <input type="text" name="username" size="50" required="required" [(ngModel)]="model.username" ngControl="username" #username="ngForm" />
  4.  
  5. Password:
  6. <input type="password" name="password" size="20" required="required" [(ngModel)]="model.password" ngControl="password" #password="ngForm" testdir />
  7.  
  8. <input type="submit" value="Login" />
  9. </form>
  10.  
  11. import {Component} from 'angular2/core';
  12.  
  13. import {TestDirective} from '../../directives/test.directive';
  14.  
  15. @Component({
  16. selector: 'test-app',
  17. templateUrl: 'login-form.html',
  18. directives: [TestDirective]
  19. })
  20. export class TestApp {}
  21.  
  22. import {Directive} from 'angular2/core';
  23.  
  24. @Directive({
  25. selector: '[testdir]',
  26. host: {
  27. '(keydown)': 'run()'
  28. }
  29. })
  30. export class TestDirective {
  31.  
  32. varpassword: string;
  33.  
  34. constructor() {
  35. this.varpassword = [******]
  36. }
  37.  
  38. run() {
  39. console.log( this.varpassword );
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement