Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form #testForm="ngForm">
- Email Address:
- <input type="text" name="username" size="50" required="required" [(ngModel)]="model.username" ngControl="username" #username="ngForm" />
- Password:
- <input type="password" name="password" size="20" required="required" [(ngModel)]="model.password" ngControl="password" #password="ngForm" testdir />
- <input type="submit" value="Login" />
- </form>
- import {Component} from 'angular2/core';
- import {TestDirective} from '../../directives/test.directive';
- @Component({
- selector: 'test-app',
- templateUrl: 'login-form.html',
- directives: [TestDirective]
- })
- export class TestApp {}
- import {Directive} from 'angular2/core';
- @Directive({
- selector: '[testdir]',
- host: {
- '(keydown)': 'run()'
- }
- })
- export class TestDirective {
- varpassword: string;
- constructor() {
- this.varpassword = [******]
- }
- run() {
- console.log( this.varpassword );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement