Skip to content

Commit

Permalink
step3
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Myasnikov committed Dec 27, 2016
1 parent 9f397a7 commit 97a96b2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 79 deletions.
13 changes: 7 additions & 6 deletions app/core/module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { HelloComponent } from '../tasks/hello.component';
import { ListComponent } from '../tasks/list.component';
import { HelloComponent } from '../tasks/hello.component';
import { ListComponent } from '../tasks/list.component';
import { WishComponent } from '../tasks/wish.component';

@NgModule({
imports: [ BrowserModule ],
declarations: [ HelloComponent, ListComponent ],
bootstrap: [ ListComponent ]
declarations: [ ListComponent, WishComponent ],
bootstrap: [ ListComponent, WishComponent ]
})
export class NyModule { }
4 changes: 0 additions & 4 deletions app/model/person.ts

This file was deleted.

46 changes: 7 additions & 39 deletions app/tasks/list.component.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,28 @@
import { Component, OnInit } from '@angular/core';

import { Person } from '../model/person';
import { Person } from '../models/person';
import { PersonService } from '../services/person.service';

@Component({
selector: 'list',
templateUrl: './app/templates/list.html',
providers: [PersonService]
})
export class ListComponent implements OnInit {
persons: Person[];

lastId: number = 6;
constructor(private personService: PersonService) { }

add(name: string = ''): boolean {
this.lastId++;
let person: Person = {
"id": this.lastId,
"name": name
};
this.persons.push(person);
this.personService.create(name);
return false;
}

delete(person: Person = null): void {
let index = this.persons.indexOf(person);

if ( index > -1 ) {
this.persons.splice(index, 1);
}
this.personService.delete(person);
}

ngOnInit(): void {
this.persons = [
{
"id" : 1,
"name": 'Ms. Jackson'
},
{
"id" : 2,
"name": 'Mr. Philips'
},
{
"id" : 3,
"name": 'Cusine Susy'
},
{
"id" : 4,
"name": 'Antonio'
},
{
"id" : 5,
"name": 'Carl'
},
{
"id" : 6,
"name": 'Lisa'
}
];
this.persons = this.personService.getPersons();
}
}
31 changes: 1 addition & 30 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,7 @@ <h1 class="wow flipInY">It’s The time to prepare</h1>
<h2>Say couple <span class="highlight">warm words</span> for yours loved ones!</h2>
</div><!--SECTIONHEAD END-->
<div class="container">
<div class="row congratulation-wrap">
<h2>Write here your congratulations to <span class="highlight">Ms. Jackson</span>.</h2>
<div class="congratulation-form">
<form action="" method="post">

<div><textarea></textarea></div>
<input type="submit" value="Say it" name="submit" id="wish-add-btn0" class="btn btn-inverse">
</form>
</div>
</div>
<div class="row congratulation-wrap">
<h2>Write here your congratulations to <span class="highlight">Mr. Philips</span>.</h2>
<div class="congratulation-form">
<form action="" method="post">

<div><textarea></textarea></div>
<input type="submit" value="Say it" name="submit" id="wish-add-btn1" class="btn btn-inverse" disabled="disabled">
</form>
</div>
</div>
<div class="row congratulation-wrap">
<h2>Write here your congratulations to <span class="highlight">Cusine Susy</span>.</h2>
<div class="congratulation-form">
<form action="" method="post">

<div><textarea></textarea></div>
<input type="submit" value="Say it" name="submit" id="wish-add-btn2" class="btn btn-inverse">
</form>
</div>
</div>
<wish>Wishes loading...</wish>
</div>
</div>
<div class="col-md-6 col-lg-4">
Expand Down

0 comments on commit 97a96b2

Please sign in to comment.