コントローラのコードで、以下の行を使用して上記の問題を解決しました。
FlashService.Success(($scope.capitalizeFirstLetter(type) +" upload successfully"),false);
「真」の代わりに「偽」を使用しました。
flash.service.js:
angular
.module('app')
.factory('FlashService', FlashService);
FlashService.$inject = ['$rootScope'];
function FlashService($rootScope) {
var service = {};
service.Success = Success;
service.Error = Error;
initService();
return service;
function initService() {
$rootScope.$on('$locationChangeStart', function() {
clearFlashMessage();
});
function clearFlashMessage() {
var flash = $rootScope.flash;
if (flash) {
if (!flash.keepAfterLocationChange) {
delete $rootScope.flash;
} else {
// only keep for a single location change
flash.keepAfterLocationChange = false;
}
}
}
}
function Success(message, keepAfterLocationChange) {
$rootScope.flash = {
message: message,
type: 'success',
keepAfterLocationChange: keepAfterLocationChange
};
}
function Error(message, keepAfterLocationChange) {
$rootScope.flash = {
message: message,
type: 'error',
keepAfterLocationChange: keepAfterLocationChange
};
}
}
あなたはフラッシュメッセージを指定を除去するためのスコープにイベントを破壊$を使用することができます。 –