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 {
color: magenta;
font-weight: bold;
height: 30px;
}
.centre {

View File

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