-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniil Myasnikov
committed
Dec 25, 2016
1 parent
3a4e9cb
commit f9149a0
Showing
5 changed files
with
85 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'list', | ||
templateUrl: './app/templates/list.html', | ||
}) | ||
export class ListComponent { | ||
persons: Object[] = [ | ||
{ | ||
"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' | ||
} | ||
]; | ||
|
||
lastId: number = 6; | ||
|
||
add(name: string = '') { | ||
this.lastId++; | ||
let person: Object = { | ||
"id": this.lastId, | ||
"name": name | ||
}; | ||
this.persons.push(person); | ||
return false; | ||
} | ||
|
||
delete(person: Object = null) { | ||
let index = this.persons.indexOf(person); | ||
|
||
if ( index > -1 ) { | ||
this.persons.splice(index, 1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!--ADD LOVED ONES FORM START--> | ||
<div class="mailchimp"> | ||
<form action="" method="post"> | ||
|
||
<input type="text" value="" name="fname" id="list-add-fname" placeholder="Enter the Name" required #personInput> | ||
<input type="submit" value="Add" name="add" id="list-add-btn" class="btn btn-inverse" (click)=add(personInput.value)> | ||
</form> | ||
</div><!--ADD LOVED ONES FORM END--> | ||
|
||
<div class="loved-list"> | ||
<div class="row" *ngFor="let item of persons"> | ||
<div class="col-md-10 col-lg-10">{{ item.name }}</div> | ||
<div class="col-md-1 col-lg-1"><i class="material-icons" (click)="delete(item)">delete</i></div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters