Skip to content

Commit

Permalink
Merge branch 'feature/ng1.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Bucholtz committed Apr 8, 2016
2 parents 45e563c + 6478b5d commit b0218b5
Show file tree
Hide file tree
Showing 9 changed files with 389 additions and 56 deletions.
1 change: 0 additions & 1 deletion config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var buildConfig = require('./build.config.js');
var path = require('canonical-path');

module.exports = function(includeCodeCoverage){
console.log("in the function");
var config = {};

config.files = [
Expand Down
18 changes: 11 additions & 7 deletions js/angular/controller/refresherController.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,17 @@ IonicModule
};

function destroy() {
ionic.off(touchStartEvent, handleTouchstart, scrollChild);
ionic.off(touchMoveEvent, handleTouchmove, scrollChild);
ionic.off(touchEndEvent, handleTouchend, scrollChild);
ionic.off('mousedown', handleMousedown, scrollChild);
ionic.off('mousemove', handleTouchmove, scrollChild);
ionic.off('mouseup', handleTouchend, scrollChild);
ionic.off('scroll', handleScroll, scrollParent);
if ( scrollChild ) {
ionic.off(touchStartEvent, handleTouchstart, scrollChild);
ionic.off(touchMoveEvent, handleTouchmove, scrollChild);
ionic.off(touchEndEvent, handleTouchend, scrollChild);
ionic.off('mousedown', handleMousedown, scrollChild);
ionic.off('mousemove', handleTouchmove, scrollChild);
ionic.off('mouseup', handleTouchend, scrollChild);
}
if ( scrollParent ) {
ionic.off('scroll', handleScroll, scrollParent);
}
scrollParent = null;
scrollChild = null;
}
Expand Down
13 changes: 11 additions & 2 deletions js/angular/controller/scrollController.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ function($scope,
deregisterInstance();
scrollView && scrollView.__cleanup && scrollView.__cleanup();
angular.element($window).off('resize', resize);
$element.off('scroll', scrollFunc);
scrollView = self.scrollView = scrollViewOptions = self._scrollViewOptions = scrollViewOptions.el = self._scrollViewOptions.el = $element = self.$element = element = null;
if ( $element ) {
$element.off('scroll', scrollFunc);
}
if ( self._scrollViewOptions ) {
self._scrollViewOptions.el = null;
}
if ( scrollViewOptions ) {
scrollViewOptions.el = null;
}

scrollView = self.scrollView = scrollViewOptions = self._scrollViewOptions = element = self.$element = $element = null;
});

$timeout(function() {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"karma-coverage": "^0.4.2",
"karma-jasmine": "~0.1.5",
"karma-mocha-reporter": "^1.0.2",
"karma-phantomjs-launcher": "~0.1.2",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sauce-launcher": "~0.2.0",
"karma-script-launcher": "~0.1.0",
"lodash": "^2.4.1",
Expand All @@ -55,6 +55,7 @@
"node-libs-browser": "^0.5.2",
"node-twitter-api": "^1.2.2",
"node-uuid": "^1.4.1",
"phantomjs-prebuilt": "^2.1.7",
"protractor": "^0.23.1",
"q": "^1.0.1",
"request": "^2.36.0",
Expand Down
50 changes: 50 additions & 0 deletions test/html/checkbox-watch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link href="/dist/css/ionic.min.css" rel="stylesheet">
<script src="/dist/js/ionic.bundle.js"></script>
</head>
<body ng-app="app">
<ion-pane>
<ion-header-bar class="bar-stable">
<h1 class="title">Awesome App</h1>
</ion-header-bar>
<ion-content>

<ion-checkbox ng-model="test">test -- {{test}}</ion-checkbox>
<br>
<ion-checkbox ng-model="nested.test">nested.test - {{nested.test}}</ion-checkbox>
<hr>
<div ng-repeat="msg in log track by $index">{{msg}}</div>

</ion-content>
</ion-pane>
</body>
<script>
angular.module('app', ['ionic'])
.run(function ($rootScope, $interval) {

$rootScope.log = [];
$rootScope.test = true;
$rootScope.nested = { test: true };

$rootScope.$watch('test', function () {
$rootScope.log.push('test watch');
});

$rootScope.$watch('nested.test', function () {
$rootScope.log.push('nested.test watch');
});

$interval(function(){
//$rootScope.test = ! $rootScope.test;
//console.log("Value of $rootScope.test is: ", $rootScope.test);
//console.log("Value of $rootScope.nested.test is: ", $rootScope.nested.test);
}, 500);

});

</script>
</html>
276 changes: 276 additions & 0 deletions test/html/sidemenu-starter.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>

<link href="/dist/css/ionic.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="/dist/js/ionic.bundle.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
</head>

<body ng-app="starter">
<ion-nav-view></ion-nav-view>
</body>

<script id="templates/browse.html" type="text/ng-template">
<ion-view view-title="Browse">
<ion-content>
<h1>Browse</h1>
</ion-content>
</ion-view>
</script>

<script id="templates/login.html" type="text/ng-template">
<ion-modal-view>
<ion-header-bar>
<h1 class="title">Login</h1>
<div class="buttons">
<button class="button button-clear" ng-click="closeLogin()">Close</button>
</div>
</ion-header-bar>
<ion-content>
<form ng-submit="doLogin()">
<div class="list">
<label class="item item-input">
<span class="input-label">Username</span>
<input type="text" ng-model="loginData.username">
</label>
<label class="item item-input">
<span class="input-label">Password</span>
<input type="password" ng-model="loginData.password">
</label>
<label class="item">
<button class="button button-block button-positive" type="submit">Log in</button>
</label>
</div>
</form>
</ion-content>
</ion-modal-view>
</script>

<script id="templates/menu.html" type="text/ng-template">
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>

<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>

<ion-side-menu side="left">
<ion-header-bar class="bar-stable">
<h1 class="title">Left</h1>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item menu-close ng-click="login()">
Login
</ion-item>
<ion-item menu-close href="#/app/search">
Search
</ion-item>
<ion-item menu-close href="#/app/browse">
Browse
</ion-item>
<ion-item menu-close href="#/app/playlists">
Playlists
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
</script>

<script id="templates/playlist.html" type="text/ng-template">
<ion-view view-title="Playlist">
<ion-content has-header="true">
<ion-list show-delete="false" type="card">
<ion-item class="rs-item item-icon-right" ng-repeat="contact in contacts">
<div style="display:inline">
<ion-checkbox ng-model="contact.checked" ng-checked="contact.checked">
<img ng-src={{contact.avatar}}>
<p>{{contact.displayName}}</p>
</ion-checkbox>
<!--<p>{{contact.displayName}}</p>-->
</div>
<ion-option-button style="background-color: #666;" ng-click="edit(item)"> Edit </ion-option-button>
<ion-delete-button ng-click="onItemDelete(item)"></ion-delete-button>
</ion-item>
</ion-list>
</ion-content>
</ion-view>
</script>

<script id="templates/playlists.html" type="text/ng-template">
<ion-view view-title="Playlists">
<ion-content>
<ion-list>
<ion-item ng-repeat="playlist in playlists" href="#/app/playlists/{{playlist.id}}">
{{playlist.title}}
</ion-item>
</ion-list>
</ion-content>
</ion-view>
</script>

<script id="templates/search.html" type="text/ng-template">
<ion-view view-title="Search">
<ion-content>
<h1>Search</h1>
</ion-content>
</ion-view>
</script>

<script>
angular.module('starter', ['ionic', 'starter.controllers'])

.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);

}
if (window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})

.config(function($stateProvider, $urlRouterProvider) {
$stateProvider

.state('app', {
url: '/app',
abstract: true,
templateUrl: 'templates/menu.html',
controller: 'AppCtrl'
})

.state('app.search', {
url: '/search',
views: {
'menuContent': {
templateUrl: 'templates/search.html'
}
}
})

.state('app.browse', {
url: '/browse',
views: {
'menuContent': {
templateUrl: 'templates/browse.html'
}
}
})
.state('app.playlists', {
url: '/playlists',
views: {
'menuContent': {
templateUrl: 'templates/playlists.html',
controller: 'PlaylistsCtrl'
}
}
})

.state('app.single', {
url: '/playlists/:playlistId',
views: {
'menuContent': {
templateUrl: 'templates/playlist.html',
controller: 'PlaylistCtrl'
}
}
});
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/app/playlists');
});

angular.module('starter.controllers', [])

.controller('AppCtrl', function($scope, $ionicModal, $timeout) {

// With the new view caching in Ionic, Controllers are only called
// when they are recreated or on app start, instead of every page change.
// To listen for when this page is active (for example, to refresh data),
// listen for the $ionicView.enter event:
//$scope.$on('$ionicView.enter', function(e) {
//});

// Form data for the login modal
$scope.loginData = {};

// Create the login modal that we will use later
$ionicModal.fromTemplateUrl('templates/login.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});

// Triggered in the login modal to close it
$scope.closeLogin = function() {
$scope.modal.hide();
};

// Open the login modal
$scope.login = function() {
$scope.modal.show();
};

// Perform the login action when the user submits the login form
$scope.doLogin = function() {
console.log('Doing login', $scope.loginData);

// Simulate a login delay. Remove this and replace with your login
// code if using a login system
$timeout(function() {
$scope.closeLogin();
}, 1000);
};
})

.controller('PlaylistsCtrl', function($scope) {
$scope.playlists = [
{ title: 'Reggae', id: 1 },
{ title: 'Chill', id: 2 },
{ title: 'Dubstep', id: 3 },
{ title: 'Indie', id: 4 },
{ title: 'Rap', id: 5 },
{ title: 'Cowbell', id: 6 }
];
})

.controller('PlaylistCtrl', function($scope, $stateParams) {

var contacts = [];
contacts.push({displayName:"Item One"});
contacts.push({displayName:"Item Two"});
contacts.push({displayName:"Item Three"});
$scope.contacts = contacts;

});

</script>
</html>
Loading

0 comments on commit b0218b5

Please sign in to comment.