Skip to content

Commit

Permalink
start up a connection page to show of network features and to clarify…
Browse files Browse the repository at this point in the history
… the ionic-team#60 - ensure demo app uses current ngCordova.js and set to newest ionic beta release
  • Loading branch information
pellekrogholt committed Jun 18, 2014
1 parent 805d582 commit d24c63d
Show file tree
Hide file tree
Showing 10 changed files with 416 additions and 16 deletions.
2 changes: 2 additions & 0 deletions config/build.config.js
Expand Up @@ -15,6 +15,8 @@ module.exports = {

jsFiles: ['src/**/*.js'],

demoAppNgCordovaLib: 'demo/app/www/lib/ngCordova',

versionData: {
version: pkg.version
}
Expand Down
2 changes: 1 addition & 1 deletion demo/app/bower.json
Expand Up @@ -2,6 +2,6 @@
"name": "HelloIonic",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-beta.6"
"ionic": "driftyco/ionic-bower#1.0.0-beta.7"
}
}
5 changes: 4 additions & 1 deletion demo/app/www/js/app.js
Expand Up @@ -43,6 +43,9 @@ angular.module('starter', ['ngCordova', 'ionic', 'starter.controllers'])
});

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/plugin/camera');
//$urlRouterProvider.otherwise('/app/plugin/camera');
// todo: back to ^^ changed to show that the landing page has network undefined
$urlRouterProvider.otherwise('/app/plugin/network');

});

44 changes: 43 additions & 1 deletion demo/app/www/js/controllers.js
Expand Up @@ -12,7 +12,8 @@ angular.module('starter.controllers', [])
{ name: 'Device Orientation', slug: 'device-orientation' },
{ name: 'Statusbar', slug: 'status-bar' },
{ name: 'Vibration', slug: 'vibration' },
{ name: 'Barcode', slug: 'barcode' }
{ name: 'Barcode', slug: 'barcode' },
{ name: 'Network', slug: 'network' }
];
})

Expand Down Expand Up @@ -113,6 +114,47 @@ angular.module('starter.controllers', [])
}
})

.controller('NetworkCtrl', function($scope, $log, $cordovaNetwork) {

var connectionType = 'undefined',
connectionIsOnline = 'undefined',
connectionIsOffline = 'undefined';

$scope.connectiontype = connectionType;
$scope.connectionIsOnline = connectionIsOnline;
$scope.connectionIsOffline = connectionIsOffline;

// we are here to show when it breaks being used/called outside a function
try {
$log.log($cordovaNetwork.getNetwork());
$scope.connectiontype = $cordovaNetwork.getNetwork();
} catch (e) {
$log.log('$cordovaNetwork.getNetwork()', e);
};

try {
$log.log($cordovaNetwork.isOnline());
$scope.connectionIsOnline = $cordovaNetwork.isOnline();
} catch (e) {
$log.log('$cordovaNetwork.isOnline()', e);
};

try {
$log.log($cordovaNetwork.isOffline());
$scope.connectionIsOffline = $cordovaNetwork.isOffline();
} catch (e) {
$log.log('$cordovaNetwork.isOffline()', e);
};

$scope.connectionStatus = function () {
$scope.connectiontype = $cordovaNetwork.getNetwork();
$scope.connectionIsOnline = $cordovaNetwork.isOnline();
$scope.connectionIsOffline = $cordovaNetwork.isOffline();
};

})


.controller('BarcodeCtrl', function($scope, $cordovaBarcodeScanner) {

$scope.scan = function() {
Expand Down

0 comments on commit d24c63d

Please sign in to comment.