const DemoApp = angular.module('DemoApp', ['dx']);
DemoApp.controller('DemoController', ($scope) => {
$scope.navSelectedIndex = 0;
$scope.navBarData = navData;
$scope.listData = [{
data: new DevExpress.data.DataSource({
store: contacts,
sort: 'name',
}),
},
{
data: new DevExpress.data.DataSource({
store: contacts,
sort: 'name',
filter: ['category', '=', 'Missed'],
}),
},
{
data: new DevExpress.data.DataSource({
store: contacts,
sort: 'name',
filter: ['category', '=', 'Favorites'],
}),
},
];
$scope.currentData = $scope.listData[0].data;
$scope.$watch('navSelectedIndex', (newValue) => {
$scope.currentData = $scope.listData[newValue].data;
});
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/22.1.4/css/dx.common.css" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/22.1.4/css/dx.light.css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
<script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script>
<script src="https://cdn3.devexpress.com/jslib/22.1.4/js/dx.all.js"></script>
<script src="data.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script src="index.js"></script>
</head>
<body class="dx-viewport">
<div class="demo-container" ng-app="DemoApp" ng-controller="DemoController">
<div
dx-list="{
bindingOptions: {
dataSource: {
deep: false,
dataPath: 'currentData'
}
}
}"
dx-item-alias="contact"
>
<div data-options="dxTemplate: { name: 'item' }">
<div class="image-container">
<img ng-src="{{contact.image}}" />
</div>
<div class="info">
<div>{{contact.name}}</div>
<div>{{contact.phone}}</div>
<div>{{contact.email}}</div>
</div>
</div>
</div>
<div
dx-nav-bar="{
dataSource: navBarData,
bindingOptions: {
selectedIndex: 'navSelectedIndex'
}
}"
></div>
</div>
</body>
</html>
.dx-list {
height: 90%;
position: absolute;
top: 0;
bottom: 0;
}
.info {
margin-top: 5px;
height: 78px;
}
.image-container {
width: 65px;
float: left;
margin-right: 20px;
}
.image-container img {
display: block;
width: 100%;
}
.dx-tabs.dx-navbar {
text-align: center;
position: absolute;
bottom: 0;
}
const contacts = [
{
name: 'Barbara J. Coggins', phone: '512-964-2757', image: '../../../../images/employees/04.png', email: 'BarbaraJCoggins@rhyta.com', category: 'Favorites',
},
{
name: 'Leslie S. Alcantara', phone: '360-684-1334', image: '../../../../images/employees/01.png', email: 'LeslieSAlcantara@teleworm.us', category: 'Missed',
},
{
name: 'Chad S. Miles', phone: '520-573-7903', image: '../../../../images/employees/02.png', email: 'ChadSMiles@rhyta.com', category: 'Favorites',
},
{
name: 'Michael A. Blevins', phone: '530-480-1961', image: '../../../../images/employees/03.png', email: 'MichaelABlevins@armyspy.com', category: 'Missed',
},
{
name: 'Jane K. Hernandez', phone: '404-781-0805', image: '../../../../images/employees/05.png', email: 'JaneKHernandez@teleworm.us', category: 'Favorites',
},
{
name: 'Kim D. Thomas', phone: '603-583-9043', image: '../../../../images/employees/06.png', email: 'KimDThomas@teleworm.us', category: 'Outgoing call',
},
{
name: 'Donald L. Jordan', phone: '772-766-2842', image: '../../../../images/employees/07.png', email: 'DonaldLJordan@dayrep.com', category: 'Favorites',
},
{
name: 'Nicole A. Rios', phone: '213-812-8400', image: '../../../../images/employees/09.png', email: 'NicoleARios@armyspy.com', category: 'Missed',
},
{
name: 'Barbara M. Roberts', phone: '614-365-7945', image: '../../../../images/employees/08.png', email: 'BarbaraMRoberts@armyspy.com', category: 'Outgoing call',
},
];
const navData = [{
text: 'Contacts',
icon: 'user',
}, {
text: 'Missed',
icon: 'clock',
badge: 3,
}, {
text: 'Favorites',
icon: 'favorites',
},
];