From aadb176a4ed78ab3fd3f52394c70c8662e04a44a Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 12 May 2015 13:51:23 -0500 Subject: [PATCH] Segment working again --- gulpfile.js | 10 ++++++++++ ionic/components/button/button.js | 14 ++++++++------ ionic/components/content/content.js | 1 + ionic/components/segment/segment.js | 16 +++++++++++----- ionic/components/segment/test/basic/index.js | 5 +++-- 5 files changed, 33 insertions(+), 13 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 8405692028..b044cfd588 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -20,6 +20,16 @@ var exec = require('child_process').exec; // !!! TEMP HACK !!! // first run ./update-angular.sh + +gulp.task('build', function() { + runSequence( + 'clean', + 'ionic.copy.js', + 'ionic.examples', + 'sass'); + +}) + gulp.task('watch', function() { runSequence( diff --git a/ionic/components/button/button.js b/ionic/components/button/button.js index d2fc55045d..55ec39c105 100644 --- a/ionic/components/button/button.js +++ b/ionic/components/button/button.js @@ -1,4 +1,4 @@ -import {NgElement} from 'angular2/angular2' +import { ElementRef} from 'angular2/angular2' import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; import {IonicComponent} from 'ionic/config/component' @@ -8,12 +8,14 @@ import {IonicComponent} from 'ionic/config/component' }) export class Button { constructor( + elementRef: ElementRef //@NgElement() ngElement:NgElement ) { - //this.domElement = ngElement.domElement + this.domElement = elementRef.domElement; + this.config = Button.config.invoke(this); } } -// new IonicComponent(Button, { -// enhanceRawElement: true, -// propClasses: ['primary', 'secondary', 'danger', 'light', 'stable', 'dark', 'block', 'clear', 'full', 'icon'] -// }) +new IonicComponent(Button, { + enhanceRawElement: true, + propClasses: ['primary', 'secondary', 'danger', 'light', 'stable', 'dark', 'block', 'clear', 'full', 'icon'] +}) diff --git a/ionic/components/content/content.js b/ionic/components/content/content.js index 0cdd0a84e1..c566d2abcb 100644 --- a/ionic/components/content/content.js +++ b/ionic/components/content/content.js @@ -1,3 +1,4 @@ +import {Renderer, ElementRef} from 'angular2/angular2' import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; import {View} from 'angular2/src/core/annotations_impl/view'; diff --git a/ionic/components/segment/segment.js b/ionic/components/segment/segment.js index a4f4130410..43f295c1f2 100644 --- a/ionic/components/segment/segment.js +++ b/ionic/components/segment/segment.js @@ -1,10 +1,17 @@ -import {NgElement, Renderer, ElementRef, Component, DefaultValueAccessor, View, Ancestor, Optional, Decorator, Directive} from 'angular2/angular2' +import {Renderer, ElementRef} from 'angular2/angular2' + +import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; +import {Ancestor} from 'angular2/src/core/annotations_impl/visibility'; +import {View} from 'angular2/src/core/annotations_impl/view'; + import {ControlGroup, ControlDirective} from 'angular2/forms' import {dom} from 'ionic/util'; import {IonicComponent} from 'ionic/config/component' import {Button} from 'ionic/components/button/button' +console.log('NGELEMENT', ElementRef); + @Component({ selector: 'ion-segment', hostListeners: { @@ -26,12 +33,12 @@ import {Button} from 'ionic/components/button/button' }) export class Segment { constructor( - @NgElement() ngElement:NgElement, elementRef: ElementRef, renderer: Renderer, cd:ControlDirective ) { - this.domElement = ngElement.domElement + console.log('ELEMENT REF INJECT', elementRef); + this.domElement = elementRef.domElement this.config = Segment.config.invoke(this) this.elementRef = elementRef; this.renderer = renderer; @@ -116,11 +123,10 @@ new IonicComponent(Segment, { export class SegmentButton { constructor( @Ancestor() segment: Segment, - @NgElement() ngElement:NgElement, elementRef: ElementRef, renderer: Renderer ) { - this.domElement = ngElement.domElement + this.domElement = elementRef.domElement this.segment = segment; segment.register(this); diff --git a/ionic/components/segment/test/basic/index.js b/ionic/components/segment/test/basic/index.js index d1712273d4..699e77af41 100644 --- a/ionic/components/segment/test/basic/index.js +++ b/ionic/components/segment/test/basic/index.js @@ -2,13 +2,14 @@ import {bootstrap} from 'angular2/angular2' import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; import {View} from 'angular2/src/core/annotations_impl/view'; +import {Segment, SegmentButton, Content, Button} from 'ionic/ionic'; import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms'; -import {IONIC_DIRECTIVES} from 'ionic/ionic' +//import {IONIC_DIRECTIVES} from 'ionic/ionic' @Component({ selector: 'ion-app' }) @View({ templateUrl: 'main.html', - directives: [FormDirectives].concat(IONIC_DIRECTIVES) + directives: [FormDirectives].concat([Segment, SegmentButton, Content, Button]) }) class IonicApp { constructor() {