From 0ae9051e7fd6fa740c9defc628303e33a62fea58 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 6 Oct 2014 14:50:39 +0200 Subject: only get route id if route with an id is present --- js/build/app.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'js/build/app.js') diff --git a/js/build/app.js b/js/build/app.js index 845091a87..aeb10949f 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -363,6 +363,10 @@ app.controller('NavigationController', this.feedError = ''; this.folderError = ''; + var getRouteId = function () { + return parseInt($route.current.params.id, 10); + }; + this.getFeeds = function () { return FeedResource.getAll(); }; @@ -430,7 +434,7 @@ app.controller('NavigationController', var type = $route.current.$$route.type; if (type === FEED_TYPE.FEED) { - var feed = FeedResource.getById($route.current.params.id); + var feed = FeedResource.getById(getRouteId()); if (feed !== undefined && feed.folderId === folderId) { return true; @@ -451,17 +455,15 @@ app.controller('NavigationController', }; this.isFolderActive = function (folderId) { - var currentId = parseInt($route.current.params.id, 10); return $route.current && $route.current.$$route.type === FEED_TYPE.FOLDER && - currentId === folderId; + getRouteId() === folderId; }; this.isFeedActive = function (feedId) { - var currentId = parseInt($route.current.params.id, 10); return $route.current && $route.current.$$route.type === FEED_TYPE.FEED && - currentId === feedId; + getRouteId() === feedId; }; this.folderNameExists = function (folderName) { -- cgit v1.2.3