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
1 parent
049b52b
commit 2664150
Showing
3 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
let todos = [ | ||
{ title: 'Install Angular CLI', isDone: true }, | ||
{ title: 'Style app', isDone: true }, | ||
{ title: 'Finish service functionality', isDone: false }, | ||
{ title: 'Setup API', isDone: false }, | ||
{ _id: 1, title: 'Install Angular CLI', isDone: true }, | ||
{ _id: 2, title: 'Style app', isDone: true }, | ||
{ _id: 3, title: 'Finish service functionality', isDone: false }, | ||
{ _id: 4, title: 'Setup API', isDone: false }, | ||
]; | ||
|
||
@Injectable() | ||
|
@@ -23,4 +23,12 @@ export class TodoService { | |
}); | ||
} | ||
|
||
put(data) { | ||
return new Promise(resolve => { | ||
let index = todos.findIndex(todo => todo._id === data._id); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
albertjimenez
|
||
todos[index].title = data.title; | ||
resolve(data); | ||
}); | ||
} | ||
|
||
} |
I got this error !!! property '_id' does not exist on type '{title:string; isDone: boolean;} when i put
let index = todos.findIndex(todo => todo._id === data._id);