58 lines
1.1 KiB
Plaintext
58 lines
1.1 KiB
Plaintext
|
'use strict';
|
||
|
|
||
|
tcrudUI.factory('navigationService', ['$route', '$rootScope',
|
||
|
function($route, $rootScope) {
|
||
|
|
||
|
var actions = {
|
||
|
save: null,
|
||
|
cancel: null,
|
||
|
open: null,
|
||
|
delete: null,
|
||
|
create: null,
|
||
|
refresh: null
|
||
|
};
|
||
|
var resetActions = function() {
|
||
|
for (var key in actions) {
|
||
|
if (key.indexOf('Impl') > 0) {
|
||
|
continue;
|
||
|
}
|
||
|
actions[key] = null;
|
||
|
}
|
||
|
};
|
||
|
actions.saveImpl = function() {
|
||
|
actions.save();
|
||
|
resetActions();
|
||
|
};
|
||
|
actions.cancelImpl = function() {
|
||
|
actions.cancel();
|
||
|
resetActions();
|
||
|
};
|
||
|
actions.openImpl = function() {
|
||
|
actions.open();
|
||
|
resetActions();
|
||
|
};
|
||
|
actions.deleteImpl = function() {
|
||
|
actions.delete();
|
||
|
resetActions();
|
||
|
};
|
||
|
|
||
|
var pageTabs = [];
|
||
|
var pageTitle = '';
|
||
|
var pageLocations = [];
|
||
|
|
||
|
$rootScope.$on('$routeChangeSuccess', function() {
|
||
|
pageTabs = [];
|
||
|
pageTitle = '';
|
||
|
pageLocations = [];
|
||
|
resetActions(); // to late gives flikering..
|
||
|
//$rootScope.$apply();
|
||
|
});
|
||
|
return {
|
||
|
actions: actions,
|
||
|
pageTabs: pageTabs,
|
||
|
pageTitle: pageTitle,
|
||
|
pageLocations: pageLocations,
|
||
|
};
|
||
|
}
|
||
|
]);
|