[Mobile] Consolidate BrowseTreeController
Make mobile variant of BrowseTreeController the regular version of that controller; Browse mode has a dependency on mobile by way of the mct-device directive anyway.
This commit is contained in:
@@ -21,19 +21,39 @@
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
|
||||
/**
|
||||
* Controller to provide the ability to show/hide the tree in
|
||||
* Browse mode.
|
||||
* @constructor
|
||||
* @memberof platform/commonUI/browse
|
||||
*/
|
||||
function BrowseTreeController() {
|
||||
function BrowseTreeController($scope, navigationService, agentService) {
|
||||
var object = navigationService.getNavigation(),
|
||||
self = this;
|
||||
|
||||
// Collapse tree when navigation changes
|
||||
function changeObject(newObject) {
|
||||
if (newObject !== object && agentService.isPortrait()) {
|
||||
object = newObject;
|
||||
self.state = false;
|
||||
}
|
||||
}
|
||||
|
||||
// On phones, trees should collapse in portrait mode
|
||||
// when something is navigated-to.
|
||||
if (agentService.isPhone()) {
|
||||
navigationService.addListener(changeObject);
|
||||
$scope.$on("$destroy", function () {
|
||||
navigationService.removeListener(changeObject);
|
||||
});
|
||||
}
|
||||
|
||||
this.state = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user