improve message

This commit is contained in:
Steve Waterworth
2018-01-10 17:36:37 +00:00
parent afc831ccfe
commit 7bf15b54e9
2 changed files with 8 additions and 6 deletions

View File

@@ -138,6 +138,7 @@ table.credentials {
.message { .message {
color: magenta; color: magenta;
font-weight: bold; font-weight: bold;
height: 30px;
} }
.centre { .centre {

View File

@@ -110,9 +110,9 @@
}); });
}); });
robotshop.controller('productform', function($scope, $http, $routeParams, currentUser) { robotshop.controller('productform', function($scope, $http, $routeParams, $timeout, currentUser) {
$scope.data = {}; $scope.data = {};
$scope.data.message = ''; $scope.data.message = ' ';
$scope.data.product = {}; $scope.data.product = {};
$scope.data.quantity = 1; $scope.data.quantity = 1;
@@ -125,11 +125,11 @@
}).then((res) => { }).then((res) => {
console.log('cart', res); console.log('cart', res);
$scope.data.message = 'Added to cart'; $scope.data.message = 'Added to cart';
setTimeout(clearMessage, 3000); $timeout(clearMessage, 3000);
}).catch((e) => { }).catch((e) => {
console.log('ERROR', e); console.log('ERROR', e);
$scope.data.message = 'ERROR ' + e; $scope.data.message = 'ERROR ' + e;
setTimeout(clearMessage, 3000); $timeout(clearMessage, 3000);
}); });
}; };
@@ -145,7 +145,8 @@
} }
function clearMessage() { function clearMessage() {
$scope.data.message = ''; console.log('clear message');
$scope.data.message = ' ';
} }
loadProduct($routeParams.sku); loadProduct($routeParams.sku);