$scope.model = {
simpsons: [
{
display: 'Abe',
items: [
{
display: 'Homer', items: [
{display: 'Bart', stateName: 'Homer-Bart'},
{display: 'Lisa', stateName: 'Homer-Lisa'},
{display: 'Maggie', stateName: 'Homer-Maggie'}
]
},
{display: 'Herb', stateName: 'Herb'},
{display: 'Abbie', stateName: 'Abbie'}
]
},
{
display: 'Jacqueline',
items: [
{display: 'Patty', stateName: 'Patty'},
{display: 'Selma', stateName: 'Selma'},
{
display: 'Marge', items: [
{display: 'Bart', stateName: 'Marge-Bart'},
{display: 'Lisa', stateName: 'Marge-Lisa'},
{display: 'Maggie', stateName: 'Marge-Maggie'}
]
},
]
}
],
characters: [
{
display: 'Howard Cunningham', items: [
{display: 'Richie Cunningham', stateName: 'Richie'},
{display: 'Joanie Cunningham', stateName: 'Joanie'}
]
},
{display: 'Potsie', stateName: 'Potsie', catchPhrase: 'What\'s a catch phrase?'},
{display: 'Fonzie', stateName: 'Fonzie', catchPhrase: 'Heeeeeeeeey!'}
]
};
$scope.simpsonsKey = $scope.$id + 'simpsons';
$scope.happyDaysKey = $scope.$id + 'characters';
eaTreeViewFactory.setItems($scope.model.simpsons, $scope.simpsonsKey);
eaTreeViewFactory.setItems($scope.model.characters, $scope.happyDaysKey);
$scope.showPicture = function(item) {
$scope.model.catchPhrase = null;
$scope.model.imageSource = '/demo/images/' + item.stateName + '.jpg';
$scope.model.imageAlt = item.display;
};
$scope.showCatchPhrase = function(item) {
$scope.model.imageSource = null;
$scope.model.imageAlt = null;
$scope.model.catchPhrase = item.catchPhrase;
};