alpha.36 update

This commit is contained in:
Adam Bradley
2015-09-02 21:50:24 -05:00
parent 63b7c14492
commit 217546abb1
8 changed files with 137 additions and 226 deletions

View File

@@ -31,6 +31,8 @@ function getBabelOptions(moduleName, moduleType) {
modules: moduleType || "system",
moduleIds: true,
getModuleId: function(name) {
if (moduleName === "index") return moduleName;
return moduleName + '/' + name.split('/test').join('');
}
}
@@ -177,7 +179,7 @@ gulp.task('bundle.ionic', ['transpile'], function() {
'dist/src/es5/system/ionic/**/*.js'
])
.pipe(concat('ionic.js'))
.pipe(insert.append('System.config({ "paths": { "ionic/*": "ionic/*" } });'))
.pipe(insert.prepend('System.config({ "paths": { "ionic/*": "ionic/*", "rx": "rx" } });\n'))
.pipe(gulp.dest('dist/js/'));
//TODO minify + sourcemaps
});
@@ -203,7 +205,7 @@ gulp.task('e2e', function() {
var buildTest = lazypipe()
//.pipe(traceur, traceurOptions)
.pipe(tsc, tscOptions, null, tscReporter)
.pipe(babel, getBabelOptions('e2e'))
.pipe(babel, getBabelOptions('index'))
var buildE2ETest = lazypipe()
//.pipe(traceur, traceurOptions)

View File

@@ -1,5 +1,5 @@
import {Component, View, bootstrap, ElementRef, NgZone, bind, DynamicComponentLoader, Injector} from 'angular2/angular2';
import {routerInjectables, HashLocationStrategy, LocationStrategy, Router} from 'angular2/router';
import {ROUTER_BINDINGS, HashLocationStrategy, LocationStrategy, Router} from 'angular2/router';
import {IonicConfig} from '../../config/config';
import {Platform} from '../../platform/platform';
@@ -52,6 +52,7 @@ export class IonicApp {
* @param {string} val Value to set the document title to.
*/
title(val) {
// TODO: User angular service
document.title = val;
}
@@ -166,6 +167,8 @@ export class IonicApp {
}
});
bodyEle.setAttribute('mode', config.setting('mode'));
/**
* Hairline Shim
* Add the "hairline" CSS class name to the body tag
@@ -174,15 +177,13 @@ export class IonicApp {
if (window.devicePixelRatio >= 2) {
var hairlineEle = document.createElement('div');
hairlineEle.style.border = '.5px solid transparent';
document.body.appendChild(hairlineEle);
bodyEle.appendChild(hairlineEle);
if (hairlineEle.offsetHeight === 1) {
document.body.classList.add('hairlines');
bodyEle.classList.add('hairlines');
}
document.body.removeChild(hairlineEle);
bodyEle.removeChild(hairlineEle);
}
bodyEle.setAttribute('mode', config.setting('mode'));
}
/**
@@ -216,7 +217,7 @@ function initApp(window, document, config) {
setTimeout(() => {
// start listening for resizes XXms after the app starts
window.addEventListener('resize', Platform.winResize);
}, 2000);
}, 2500);
return app;
}
@@ -282,7 +283,7 @@ export function ionicBootstrap(rootComponentType, config) {
bind(ActionMenu).toValue(actionMenu),
bind(Modal).toValue(modal),
bind(Popup).toValue(popup),
routerInjectables,
ROUTER_BINDINGS,
bind(LocationStrategy).toClass(HashLocationStrategy)
]);

View File

@@ -1,5 +1,123 @@
import {App, NavController} from 'ionic/ionic';
import {FirstPage} from './pages/first-page';
import {IonicView, IonicConfig, IonicApp} from 'ionic/ionic';
import {NavParams, NavController} from 'ionic/ionic';
@IonicView({
template: '' +
'<ion-navbar *navbar primary>' +
'<ion-title>{{title}}</ion-title>' +
'<ion-nav-items secondary>' +
'<button>S1</button>' +
'</ion-nav-items>' +
'</ion-navbar>' +
'<ion-content class="padding">' +
'<p>{{title}}</p>' +
'<p><button id="from1To2" primary (click)="push()">Push (Go to 2nd)</button></p>' +
'<p><button [push-data]="pushData" [nav-push]="pushPage">Push w/ nav-push (Go to 2nd)</button></p>' +
'<p><button (click)="setItems()">setItems() (Go to 3rd, no history)</button></p>' +
'<icon class="ion-ios-arrow-back"></icon>' +
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
'</ion-content>'
})
class FirstPage {
constructor(
nav: NavController,
app: IonicApp,
config: IonicConfig
) {
this.nav = nav;
this.title = 'First Page';
this.pushPage = SecondPage;
this.pushData = {
id: 420
}
}
setItems() {
let items = [
ThirdPage
];
this.nav.setItems(items);
}
push() {
this.nav.push(SecondPage, { id: 8675309, myData: [1,2,3,4] } );
}
}
@IonicView({
template: `
<ion-content class="padding">
<h1>Second page</h1>
<p>This page does not have a nav bar!</p>
<p><button (click)="pop()">Pop (Go back to 1st)</button></p>
<p><button id="from2To1" nav-pop>Pop with NavPop (Go back to 1st)</button></p>
<p><button id="from2To3" (click)="push()">Push (Go to 3rd)</button></p>
<p><button (click)="setItems()">setItems() (Go to 3rd, FirstPage 1st in history)</button></p>
<div class="green"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
</ion-content>
`
})
class SecondPage {
constructor(
nav: NavController,
params: NavParams
) {
this.nav = nav;
this.params = params;
console.log('Second page params:', params);
}
setItems() {
let items = [
FirstPage,
ThirdPage
];
this.nav.setItems(items);
}
pop() {
this.nav.pop();
}
push() {
this.nav.push(ThirdPage);
}
}
@IonicView({
template: `
<ion-navbar *navbar><ion-title>Third Page Header</ion-title></ion-navbar>
<ion-content class="padding">
<p>
<button id="from3To2" (click)="pop()">Pop (Go back to 2nd)</button>
</p>
<div class="yellow"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
</ion-content>
`
})
class ThirdPage {
constructor(
nav: NavController
) {
this.nav = nav
}
pop() {
this.nav.pop()
}
}
@App({

View File

@@ -1,80 +0,0 @@
import {IonicView, IonicConfig, IonicApp} from 'ionic/ionic';
import {NavParams, NavController} from 'ionic/ionic';
import {SecondPage} from './second-page';
import {ThirdPage} from './third-page';
@IonicView({
template: '' +
'<ion-navbar *navbar primary>' +
'<ion-title>{{title}}</ion-title>' +
'<ion-nav-items secondary>' +
'<button>S1</button>' +
'</ion-nav-items>' +
'</ion-navbar>' +
'<ion-content class="padding">' +
'<p>{{title}}</p>' +
'<p><button id="from1To2" primary (click)="push()">Push (Go to 2nd)</button></p>' +
'<p><button [push-data]="pushData" [nav-push]="pushPage">Push w/ nav-push (Go to 2nd)</button></p>' +
'<p><button (click)="setItems()">setItems() (Go to 3rd, no history)</button></p>' +
'<icon class="ion-ios-arrow-back"></icon>' +
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
'<f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f>' +
'</ion-content>'
})
export class FirstPage {
constructor(
nav: NavController,
app: IonicApp,
config: IonicConfig
) {
this.nav = nav;
this.title = 'First Page';
this.pushPage = SecondPage;
this.pushData = {
id: 420
}
}
setItems() {
let items = [
ThirdPage
];
this.nav.setItems(items);
}
// viewLoaded() {
// console.log('viewLoaded first page');
// }
// viewWillEnter() {
// console.log('viewWillEnter first page');
// }
// viewDidEnter() {
// console.log('viewDidEnter first page');
// }
// viewWillLeave() {
// console.log('viewWillLeave first page');
// }
// viewDidLeave() {
// console.log('viewDidLeave first page');
// }
// viewWillUnload() {
// console.log('viewWillUnload first page');
// }
// viewDidUnload() {
// console.log('viewDidUnload first page');
// }
push() {
this.nav.push(SecondPage, { id: 8675309, myData: [1,2,3,4] } );
}
}

View File

@@ -1,75 +0,0 @@
import {IonicView, NavController, NavParams} from 'ionic/ionic';
import {ThirdPage} from './third-page';
import {FirstPage} from './first-page';
@IonicView({
template: `
<ion-content class="padding">
<h1>Second page</h1>
<p>This page does not have a nav bar!</p>
<p><button (click)="pop()">Pop (Go back to 1st)</button></p>
<p><button id="from2To1" nav-pop>Pop with NavPop (Go back to 1st)</button></p>
<p><button id="from2To3" (click)="push()">Push (Go to 3rd)</button></p>
<p><button (click)="setItems()">setItems() (Go to 3rd, FirstPage 1st in history)</button></p>
<div class="green"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
</ion-content>
`
})
export class SecondPage {
constructor(
nav: NavController,
params: NavParams
) {
this.nav = nav;
this.params = params;
console.log('Second page params:', params);
}
setItems() {
let items = [
FirstPage,
ThirdPage
];
this.nav.setItems(items);
}
pop() {
this.nav.pop();
}
push() {
this.nav.push(ThirdPage);
}
// viewLoaded() {
// console.log('viewLoaded second page');
// }
// viewWillEnter() {
// console.log('viewWillEnter second page');
// }
// viewDidEnter() {
// console.log('viewDidEnter second page');
// }
// viewWillLeave() {
// console.log('viewWillLeave second page');
// }
// viewDidLeave() {
// console.log('viewDidLeave second page');
// }
// viewWillUnload() {
// console.log('viewWillUnload second page');
// }
// viewDidUnload() {
// console.log('viewDidUnload second page');
// }
}

View File

@@ -1,54 +0,0 @@
import {IonicView, NavController} from 'ionic/ionic';
@IonicView({
template: `
<ion-navbar *navbar><ion-title>Third Page Header</ion-title></ion-navbar>
<ion-content class="padding">
<p>
<button id="from3To2" (click)="pop()">Pop (Go back to 2nd)</button>
</p>
<div class="yellow"><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f><f></f></div>
</ion-content>
`
})
export class ThirdPage {
constructor(
nav: NavController
) {
this.nav = nav
}
pop() {
this.nav.pop()
}
// viewLoaded() {
// console.log('viewLoaded third page');
// }
// viewWillEnter() {
// console.log('viewWillEnter third page');
// }
// viewDidEnter() {
// console.log('viewDidEnter third page');
// }
// viewWillLeave() {
// console.log('viewWillLeave third page');
// }
// viewDidLeave() {
// console.log('viewDidLeave third page');
// }
// viewWillUnload() {
// console.log('viewWillUnload third page');
// }
// viewDidUnload() {
// console.log('viewDidUnload third page');
// }
}

View File

@@ -7,13 +7,13 @@
"url": "https://github.com/driftyco/ionic2.git"
},
"dependencies": {
"angular2": "2.0.0-alpha.35",
"angular2": "2.0.0-alpha.36",
"reflect-metadata": "0.1.0",
"rtts_assert": "2.0.0-alpha.35",
"rtts_assert": "2.0.0-alpha.36",
"swiper": "^3.1.2",
"systemjs": "0.16.11",
"systemjs": "0.18.10",
"traceur": "0.0.91",
"zone.js": "0.5.2"
"zone.js": "0.5.4"
},
"devDependencies": {
"canonical-path": "0.0.2",

View File

@@ -53,8 +53,7 @@
<script src="../../../js/ionic.bundle.js"></script>
<script>System.config({"baseURL": "../../../"})</script>
<script>System.import("{{MODULE}}");</script>
<script>System.import("index");</script>
</body>
</html>