Properly reset add field when canceling

master
Loic Blot 2017-05-02 13:08:39 +02:00
parent c6f3df8df2
commit 4f810ec04a
2 changed files with 2 additions and 1 deletions

View File

@ -246,6 +246,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil
if (r.data != null && !undef(r.data['id'])) {
$scope.cities.push({"name": city.name, "id": r.data['id']})
$scope.showAddCity = false;
city.name = "";
}
else {
$scope.addCityError = 'Failed to add city. Please contact your administrator';

View File

@ -12,7 +12,7 @@
<div class="icon-delete svn delete action" ng-click="deleteCity(city);"></div>
</li>
<li>
<a href="#" ng-click="showAddCity = true;">Add a city...</a>
<a href="#" ng-click="city.name = ''; addCityError = ''; showAddCity = true;">Add a city...</a>
<div ng-show="showAddCity == true" id="create-city">
<h1>Add city</h1>
<hr>