Adding a new city
Before going any further, let’s spend a couple more minutes adding a very useful feature to our CityEditComponent
: the chance to add a brand-new City
. This is a rather classic requirement of a Detail view with editing capabilities, which can be handled with the same component – as long as we perform some small modifications to enable it to handle a new feature (adding a new city) as well as the existing one (editing an existing city) in a seamless way.
To do that, we’ll have to perform the following steps:
- Extend the functionalities of
CityEditComponent
to make it able to add new cities, as well as edit existing ones - Add a new Add City button to our component’s template file and bind it to a new client-side route
- Implement the required functionalities to select a country for the newly added city, which will also be useful in edit mode (it will allow users to change the country for existing cities)
Let...