mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
step forward
This commit is contained in:
@ -8,3 +8,8 @@
|
||||
to create more examples.
|
||||
* 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.
|
||||
|
||||
|
||||
#### Update Angular
|
||||
|
||||
./scripts/build/update-angular.sh
|
||||
|
@ -17,7 +17,6 @@ export class Content {
|
||||
constructor(
|
||||
@NgElement() element:NgElement
|
||||
) {
|
||||
console.log('constructing content', element.domElement);
|
||||
this.domElement = element.domElement;
|
||||
this.domElement.classList.add('content');
|
||||
}
|
||||
|
@ -2,9 +2,10 @@ import {
|
||||
NgElement,
|
||||
Component,
|
||||
Decorator,
|
||||
View as NgView,
|
||||
Viewport,
|
||||
//ViewContainerRef,
|
||||
View as NgView,
|
||||
ViewContainer,
|
||||
//ProtoViewRef,
|
||||
onDestroy,
|
||||
Ancestor,
|
||||
ElementRef,
|
||||
@ -16,6 +17,12 @@ import {NavController} from 'ionic/components/nav/nav-item';
|
||||
import {raf} from 'ionic/util/dom';
|
||||
import {platform} from 'ionic/platform/platform';
|
||||
|
||||
|
||||
// FYI for later:
|
||||
// https://github.com/angular/angular/commit/3aac2fefd7f93c74abfa5ee58aa0ea8d4840b519
|
||||
|
||||
|
||||
|
||||
@Viewport({
|
||||
selector: '[ion-toolbar]',
|
||||
properties: {
|
||||
@ -23,34 +30,38 @@ import {platform} from 'ionic/platform/platform';
|
||||
}
|
||||
})
|
||||
export class Toolbar {
|
||||
|
||||
constructor(
|
||||
//viewContainer: ViewContainerRef,
|
||||
viewContainer: ViewContainer,
|
||||
//protoViewRef: ProtoViewRef,
|
||||
elementRef: ElementRef,
|
||||
@Ancestor() navCtrl: NavController,
|
||||
element: NgElement
|
||||
// context: Object TODO wait for angular to implement this
|
||||
) {
|
||||
//this.viewContainer = viewContainer;
|
||||
this.viewContainer = viewContainer;
|
||||
this.elementRef = elementRef;
|
||||
this.navCtrl = navCtrl;
|
||||
|
||||
console.log('Toolbar!');
|
||||
|
||||
// TODO use config to add these classes
|
||||
// this.viewContainer.domElement.classList.add('toolbar');
|
||||
// this.viewContainer.domElement.classList.add(`toolbar-${platform.getName()}`);
|
||||
this.viewContainer.domElement.classList.add('toolbar');
|
||||
this.viewContainer.domElement.classList.add(`toolbar-${platform.getName()}`);
|
||||
|
||||
// TODO Make a better way than this
|
||||
// if (/header/i.test(this.viewContainer.domElement.tagName)) {
|
||||
// this.placement = 'top';
|
||||
// } else {
|
||||
// this.placement = 'bottom';
|
||||
// }
|
||||
if (/header/i.test(this.viewContainer.domElement.tagName)) {
|
||||
this.placement = 'top';
|
||||
} else {
|
||||
this.placement = 'bottom';
|
||||
}
|
||||
}
|
||||
|
||||
set placement(pos) {
|
||||
//this.viewContainer.domElement.classList.add(`toolbar-${pos}`);
|
||||
this.viewContainer.domElement.classList.add(`toolbar-${pos}`);
|
||||
this._placement = pos;
|
||||
this.navCtrl.addToolbar(this._placement, this);
|
||||
//this.viewContainer.domElement.setAttribute('placement', pos);
|
||||
this.viewContainer.domElement.setAttribute('placement', pos);
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// HACKYFILLS (hack + polyfill)
|
||||
import {NgElement, ViewContainerRef} from 'angular2/angular2'
|
||||
import {NgElement, ViewContainer} from 'angular2/angular2'
|
||||
Object.defineProperties(NgElement.prototype, {
|
||||
domElement: {
|
||||
get: function() {
|
||||
@ -8,14 +8,14 @@ Object.defineProperties(NgElement.prototype, {
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperties(ViewContainerRef.prototype, {
|
||||
Object.defineProperties(ViewContainer.prototype, {
|
||||
domElement: {
|
||||
get: function() {
|
||||
return this._defaultProtoView.render.delegate.element;
|
||||
return this.defaultProtoView.render.delegate.element;
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(ViewContainerRef)
|
||||
|
||||
export * from 'ionic/components'
|
||||
export * from 'ionic/platform/platform'
|
||||
export * from 'ionic/routing/router'
|
||||
|
@ -14,7 +14,8 @@ echo "Running npm install in angular2..."
|
||||
npm install
|
||||
|
||||
echo "Running gulp to build source..."
|
||||
gulp build/transpile.js.dev.es6
|
||||
gulp clean
|
||||
gulp build.js
|
||||
|
||||
echo "--"
|
||||
echo "-- DONE, gulp will work now --"
|
||||
|
Reference in New Issue
Block a user