Create hero-form.component.ts
Create hero-form.component.ts

import { Component } from '@angular/core';
import { Hero }    from './hero';
@Component({
    moduleId: module.id,
    selector: 'hero-form',
    templateUrl: 'hero-form.component.html'
})
export class HeroFormComponent {
    model = new Hero('AAC', 'abcde', 'abcde', '1234567890');
    submitted = false;
    onSubmit() { this.submitted = true; }
    active = true;
    newHero() {
        this.model = new Hero('ABC', '', '', '');
        this.active = false;
        setTimeout(() => this.active = true, 0);
    }
}
asunwei/angular2-learn,asunwei/angular2-learn,asunwei/angular2-learn