aboutsummaryrefslogtreecommitdiff
path: root/app/components/plan-new/plan-new.ts
blob: 4a748eadcae4f45df4e370f99a0bdae3db750070 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import {Component, OnInit} from 'angular2/core';
import {Router, ROUTER_DIRECTIVES} from 'angular2/router';
import {IPlan} from '../../interfaces/iplan';

import {PlanService} from '../../services/plan-service';

@Component({
    selector: 'plan-new',
    templateUrl: './components/plan-new/plan-new.html',
    providers: [PlanService],
    directives: [ROUTER_DIRECTIVES]
})
export class PlanNew {
    planIds: string[];
    newPlanName: string;
    newPlanContent: string;
    newPlanQuery: string;
    newPlan: IPlan;

    constructor( private _router: Router, private _planService: PlanService) { }

    submitPlan() {
        this.newPlan = this._planService.createPlan(this.newPlanName, this.newPlanContent, this.newPlanQuery);
        this._router.navigate( ['PlanView', { id: this.newPlan.id }] );
    }
}