step forward

This commit is contained in:
Adam Bradley
2015-05-02 23:20:20 -05:00
parent a425061d90
commit aba2906b29
5 changed files with 35 additions and 19 deletions

View File

@ -8,3 +8,8 @@
to create more examples. to create more examples.
* The biggest thing to remember: your app has to import its dependencies with the `app/` prefix. * The biggest thing to remember: your app has to import its dependencies with the `app/` prefix.
For example `import {Apple} from 'apple';` would import apple.js in your example app. For example `import {Apple} from 'apple';` would import apple.js in your example app.
#### Update Angular
./scripts/build/update-angular.sh

View File

@ -17,7 +17,6 @@ export class Content {
constructor( constructor(
@NgElement() element:NgElement @NgElement() element:NgElement
) { ) {
console.log('constructing content', element.domElement);
this.domElement = element.domElement; this.domElement = element.domElement;
this.domElement.classList.add('content'); this.domElement.classList.add('content');
} }

View File

@ -2,9 +2,10 @@ import {
NgElement, NgElement,
Component, Component,
Decorator, Decorator,
View as NgView,
Viewport, Viewport,
//ViewContainerRef, View as NgView,
ViewContainer,
//ProtoViewRef,
onDestroy, onDestroy,
Ancestor, Ancestor,
ElementRef, ElementRef,
@ -16,6 +17,12 @@ import {NavController} from 'ionic/components/nav/nav-item';
import {raf} from 'ionic/util/dom'; import {raf} from 'ionic/util/dom';
import {platform} from 'ionic/platform/platform'; import {platform} from 'ionic/platform/platform';
// FYI for later:
// https://github.com/angular/angular/commit/3aac2fefd7f93c74abfa5ee58aa0ea8d4840b519
@Viewport({ @Viewport({
selector: '[ion-toolbar]', selector: '[ion-toolbar]',
properties: { properties: {
@ -23,34 +30,38 @@ import {platform} from 'ionic/platform/platform';
} }
}) })
export class Toolbar { export class Toolbar {
constructor( constructor(
//viewContainer: ViewContainerRef, viewContainer: ViewContainer,
//protoViewRef: ProtoViewRef,
elementRef: ElementRef, elementRef: ElementRef,
@Ancestor() navCtrl: NavController, @Ancestor() navCtrl: NavController,
element: NgElement element: NgElement
// context: Object TODO wait for angular to implement this // context: Object TODO wait for angular to implement this
) { ) {
//this.viewContainer = viewContainer; this.viewContainer = viewContainer;
this.elementRef = elementRef; this.elementRef = elementRef;
this.navCtrl = navCtrl; this.navCtrl = navCtrl;
console.log('Toolbar!');
// TODO use config to add these classes // TODO use config to add these classes
// this.viewContainer.domElement.classList.add('toolbar'); this.viewContainer.domElement.classList.add('toolbar');
// this.viewContainer.domElement.classList.add(`toolbar-${platform.getName()}`); this.viewContainer.domElement.classList.add(`toolbar-${platform.getName()}`);
// TODO Make a better way than this // TODO Make a better way than this
// if (/header/i.test(this.viewContainer.domElement.tagName)) { if (/header/i.test(this.viewContainer.domElement.tagName)) {
// this.placement = 'top'; this.placement = 'top';
// } else { } else {
// this.placement = 'bottom'; this.placement = 'bottom';
// } }
} }
set placement(pos) { set placement(pos) {
//this.viewContainer.domElement.classList.add(`toolbar-${pos}`); this.viewContainer.domElement.classList.add(`toolbar-${pos}`);
this._placement = pos; this._placement = pos;
this.navCtrl.addToolbar(this._placement, this); this.navCtrl.addToolbar(this._placement, this);
//this.viewContainer.domElement.setAttribute('placement', pos); this.viewContainer.domElement.setAttribute('placement', pos);
} }
onDestroy() { onDestroy() {

View File

@ -1,5 +1,5 @@
// HACKYFILLS (hack + polyfill) // HACKYFILLS (hack + polyfill)
import {NgElement, ViewContainerRef} from 'angular2/angular2' import {NgElement, ViewContainer} from 'angular2/angular2'
Object.defineProperties(NgElement.prototype, { Object.defineProperties(NgElement.prototype, {
domElement: { domElement: {
get: function() { get: function() {
@ -8,14 +8,14 @@ Object.defineProperties(NgElement.prototype, {
} }
}); });
Object.defineProperties(ViewContainerRef.prototype, { Object.defineProperties(ViewContainer.prototype, {
domElement: { domElement: {
get: function() { get: function() {
return this._defaultProtoView.render.delegate.element; return this.defaultProtoView.render.delegate.element;
} }
} }
}); });
console.log(ViewContainerRef)
export * from 'ionic/components' export * from 'ionic/components'
export * from 'ionic/platform/platform' export * from 'ionic/platform/platform'
export * from 'ionic/routing/router' export * from 'ionic/routing/router'

View File

@ -14,7 +14,8 @@ echo "Running npm install in angular2..."
npm install npm install
echo "Running gulp to build source..." echo "Running gulp to build source..."
gulp build/transpile.js.dev.es6 gulp clean
gulp build.js
echo "--" echo "--"
echo "-- DONE, gulp will work now --" echo "-- DONE, gulp will work now --"