diff --git a/src/client/index.d.ts b/src/client/index.d.ts index 6613616f..92e11e45 100644 --- a/src/client/index.d.ts +++ b/src/client/index.d.ts @@ -283,6 +283,7 @@ declare module fng { formName: string; alertTitle: any; errorMessage: any; + errorHideTimer: number; save: any; newRecord: boolean; initialiseNewRecord?: any; @@ -334,7 +335,8 @@ declare module fng { generateNewUrl: any; scrollTheList: any; getListData: any; - dismissError: any; + dismissError: () => void; + stickError: () => void; handleHttpError: (response: any) => void; dropConversionWatcher: () => void; } diff --git a/src/client/js/controllers/nav.ts b/src/client/js/controllers/nav.ts index 5296c8ff..7046203b 100644 --- a/src/client/js/controllers/nav.ts +++ b/src/client/js/controllers/nav.ts @@ -98,32 +98,36 @@ module fng.controllers { }); $scope.doClick = function (index, event) { - var option = angular.element(event.target); - var item = $scope.items[index]; + const option = angular.element(event.target); + const item = $scope.items[index]; if (item.divider || option.parent().hasClass('disabled')) { event.preventDefault(); } else if (item.broadcast) { $scope.$broadcast(item.broadcast); } else { // Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke - var args = item.args || [], - fn = item.fn; - switch (args.length) { - case 0: - fn(); - break; - case 1: - fn(args[0]); - break; - case 2: - fn(args[0], args[1]); - break; - case 3: - fn(args[0], args[1], args[2]); - break; - case 4: - fn(args[0], args[1], args[2], args[3]); - break; + const args = item.args || []; + const fn = item.fn; + if (typeof fn === "function") { + switch (args.length) { + case 0: + fn(); + break; + case 1: + fn(args[0]); + break; + case 2: + fn(args[0], args[1]); + break; + case 3: + fn(args[0], args[1], args[2]); + break; + case 4: + fn(args[0], args[1], args[2], args[3]); + break; + } + } else if (fn) { + throw new Error("Incorrect menu setup") } } }; diff --git a/src/client/js/directives/dropdown.ts b/src/client/js/directives/dropdown.ts index 077a67b8..a22b73b8 100644 --- a/src/client/js/directives/dropdown.ts +++ b/src/client/js/directives/dropdown.ts @@ -13,7 +13,7 @@ module fng.directives { ' ' + '