generator-onsenui-ngcordova
Version:
63 lines (52 loc) • 1.83 kB
JavaScript
(function(){
'use strict';
var module = angular.module('app', ['onsen', 'ngCordova']);
module.controller('AppController', function($scope) {
document.addEventListener('deviceready', function(){
//$cordovaPlugin available
console.log('deviceready');
}, false);
$scope.doSomething = function() {
setTimeout(function() {
ons.notification.alert({ message: 'tapped' });
}, 100);
};
});
module.controller('DetailController', function($scope, $data) {
$scope.item = $data.selectedItem;
});
module.controller('MasterController', function($scope, $data) {
$scope.items = $data.items;
$scope.showDetail = function(index) {
var selectedItem = $data.items[index];
$data.selectedItem = selectedItem;
$scope.navi.pushPage('detail.html', {title : selectedItem.title});
};
});
module.factory('$data', function() {
var data = {};
data.items = [
{
title: 'Item 1 Title',
label: '4h',
desc: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
},
{
title: 'Another Item Title',
label: '6h',
desc: 'Ut enim ad minim veniam.'
},
{
title: 'Yet Another Item Title',
label: '1day ago',
desc: 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'
},
{
title: 'Yet Another Item Title',
label: '1day ago',
desc: 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.'
}
];
return data;
});
})();