Commit a36a7acc113cd9aa48a3a038a405677da624f671
1 parent
ced4a1ff
when change gender close it and again open with different gender, the title cont…
…ained 1 suffix becuase in openviews arrayan entry already exists so on changing gender we first remove the already exist entry of same view with diff gender and then push.
Showing
1 changed file
with
44 additions
and
6 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -5439,12 +5439,50 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
5439 | 5439 | |
5440 | 5440 | } |
5441 | 5441 | |
5442 | - $rootScope.openViews.push( | |
5443 | - { | |
5444 | - "module": $rootScope.currentActiveModuleTitle, "bodyView": localStorage.getItem("currentViewTitle"), "state": 'max', "BodyViewId": currentBodyViewId, | |
5445 | - "slug": $rootScope.currentSlug | |
5446 | - } | |
5447 | - ); | |
5442 | + var correspondingBodyViewId = $scope.correspondingBodyViewIds[currentBodyViewId]; | |
5443 | + var alraedyOpenedViewDetail; | |
5444 | + if ($rootScope.openViews != null || $rootScope.openViews != undefined) { | |
5445 | + if ($rootScope.openViews.length > 0) { | |
5446 | + alraedyOpenedViewDetail = new jinqJs() | |
5447 | + .from($rootScope.openViews) | |
5448 | + .where("BodyViewId == " + correspondingBodyViewId) | |
5449 | + .select(); | |
5450 | + } | |
5451 | + } | |
5452 | + debugger; | |
5453 | + if (alraedyOpenedViewDetail != undefined || alraedyOpenedViewDetail.length > 0) { | |
5454 | + // $rootScope.openViews.removeValue('BodyViewId', correspondingBodyViewId); | |
5455 | + | |
5456 | + findAndRemove($rootScope.openViews, 'BodyViewId', correspondingBodyViewId); | |
5457 | + function findAndRemove(array, property, value) { | |
5458 | + array.forEach(function (result, index) { | |
5459 | + if (result[property] === value) { | |
5460 | + //Remove from array | |
5461 | + array.splice(index, 1); | |
5462 | + } | |
5463 | + }); | |
5464 | + } | |
5465 | + | |
5466 | + //Checks countries.result for an object with a property of 'id' whose value is 'AF' | |
5467 | + //Then removes it ;p | |
5468 | + | |
5469 | + | |
5470 | + $rootScope.openViews.push( | |
5471 | + { | |
5472 | + "module": $rootScope.currentActiveModuleTitle, "bodyView": localStorage.getItem("currentViewTitle"), "state": 'max', "BodyViewId": currentBodyViewId, | |
5473 | + "slug": $rootScope.currentSlug | |
5474 | + } | |
5475 | + ); | |
5476 | + } | |
5477 | + | |
5478 | + else { | |
5479 | + $rootScope.openViews.push( | |
5480 | + { | |
5481 | + "module": $rootScope.currentActiveModuleTitle, "bodyView": localStorage.getItem("currentViewTitle"), "state": 'max', "BodyViewId": currentBodyViewId, | |
5482 | + "slug": $rootScope.currentSlug | |
5483 | + } | |
5484 | + ); | |
5485 | + } | |
5448 | 5486 | |
5449 | 5487 | var target = angular.element(event.currentTarget); |
5450 | 5488 | var title_male_female = target.attr('title'); | ... | ... |