Tutorial example has a problem to enter new item into an empty list
See original GitHub issueI’m submitting a…
[x] Documentation issue or request
Current behavior
“Angular Example - Tour of Heroes: Part 6” in the tutorial of Angular 5 has a problem to enter an item into the heroines.component.
- Delete all items from the list of the heroines.component.
- Enter new item in the text field and press the [add] button.
Then listed item has neither id nor name. Browser console indicates the error message like below:
body: {error: "Collection 'heroes' id type is non-numeric or unknown. Can only generate numeric ids."}
Expected behavior
New item can be entered even if the list is empty. I recommend to revise the code as “Angular 5 Example - To be able to enter new item to empty list” shows.
Minimal reproduction of the problem with instructions
See the “Current behavior” above.
What is the motivation / use case for changing the behavior?
Confused when learning the tutorial sample.
Environment
Angular version: 5.2.4
Browser:
- [x] Chrome (desktop) version 64.0.3282.140
- [x] Firefox version 58.0.1
- [x] Safari (desktop) version 11.0.3
For Tooling issues:
- Platform: macOS Sierra 10.12.6
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Python Empty List Tutorial – How to Create ... - freeCodeCamp
In the example below, we create an empty list and assign it to the variable num . Then, using a for loop, we...
Read more >Angular 5 Example - To be able to enter new item to empty list
When the array of data comes to be empty, nothing has the id property. Then number for id does not seem to be...
Read more >How to Create an Empty List in Python? - Finxter
To create an empty list in Python, you can use two ways. First, the empty square bracket notation [] creates a new list...
Read more >Python Empty List | How to Declare Empty List with Examples
In this article, an empty list is created by just declaring square brackets [] with no elements within the assignment statement's brackets. It...
Read more >Declare an empty List in Python - GeeksforGeeks
However, Have you ever wondered about how to declare an empty list in Python? This can be achieved by two ways i.e. either...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nice catch, currently the
in-memory-db
would only auto-increase theid
when there’s existingid
property and they’re numeric:Suggested fix: override the
genId
method as we know aHero
should always have anid
:Demo here.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.