mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
Segment working again
This commit is contained in:
10
gulpfile.js
10
gulpfile.js
@ -20,6 +20,16 @@ var exec = require('child_process').exec;
|
|||||||
|
|
||||||
// !!! TEMP HACK !!!
|
// !!! TEMP HACK !!!
|
||||||
// first run ./update-angular.sh
|
// first run ./update-angular.sh
|
||||||
|
|
||||||
|
gulp.task('build', function() {
|
||||||
|
runSequence(
|
||||||
|
'clean',
|
||||||
|
'ionic.copy.js',
|
||||||
|
'ionic.examples',
|
||||||
|
'sass');
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
gulp.task('watch', function() {
|
gulp.task('watch', function() {
|
||||||
|
|
||||||
runSequence(
|
runSequence(
|
||||||
|
@ -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 {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
|
|
||||||
import {IonicComponent} from 'ionic/config/component'
|
import {IonicComponent} from 'ionic/config/component'
|
||||||
@ -8,12 +8,14 @@ import {IonicComponent} from 'ionic/config/component'
|
|||||||
})
|
})
|
||||||
export class Button {
|
export class Button {
|
||||||
constructor(
|
constructor(
|
||||||
|
elementRef: ElementRef
|
||||||
//@NgElement() ngElement:NgElement
|
//@NgElement() ngElement:NgElement
|
||||||
) {
|
) {
|
||||||
//this.domElement = ngElement.domElement
|
this.domElement = elementRef.domElement;
|
||||||
|
this.config = Button.config.invoke(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// new IonicComponent(Button, {
|
new IonicComponent(Button, {
|
||||||
// enhanceRawElement: true,
|
enhanceRawElement: true,
|
||||||
// propClasses: ['primary', 'secondary', 'danger', 'light', 'stable', 'dark', 'block', 'clear', 'full', 'icon']
|
propClasses: ['primary', 'secondary', 'danger', 'light', 'stable', 'dark', 'block', 'clear', 'full', 'icon']
|
||||||
// })
|
})
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import {Renderer, ElementRef} from 'angular2/angular2'
|
||||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||||
|
|
||||||
|
@ -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 {ControlGroup, ControlDirective} from 'angular2/forms'
|
||||||
import {dom} from 'ionic/util';
|
import {dom} from 'ionic/util';
|
||||||
import {IonicComponent} from 'ionic/config/component'
|
import {IonicComponent} from 'ionic/config/component'
|
||||||
import {Button} from 'ionic/components/button/button'
|
import {Button} from 'ionic/components/button/button'
|
||||||
|
|
||||||
|
|
||||||
|
console.log('NGELEMENT', ElementRef);
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ion-segment',
|
selector: 'ion-segment',
|
||||||
hostListeners: {
|
hostListeners: {
|
||||||
@ -26,12 +33,12 @@ import {Button} from 'ionic/components/button/button'
|
|||||||
})
|
})
|
||||||
export class Segment {
|
export class Segment {
|
||||||
constructor(
|
constructor(
|
||||||
@NgElement() ngElement:NgElement,
|
|
||||||
elementRef: ElementRef,
|
elementRef: ElementRef,
|
||||||
renderer: Renderer,
|
renderer: Renderer,
|
||||||
cd:ControlDirective
|
cd:ControlDirective
|
||||||
) {
|
) {
|
||||||
this.domElement = ngElement.domElement
|
console.log('ELEMENT REF INJECT', elementRef);
|
||||||
|
this.domElement = elementRef.domElement
|
||||||
this.config = Segment.config.invoke(this)
|
this.config = Segment.config.invoke(this)
|
||||||
this.elementRef = elementRef;
|
this.elementRef = elementRef;
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
@ -116,11 +123,10 @@ new IonicComponent(Segment, {
|
|||||||
export class SegmentButton {
|
export class SegmentButton {
|
||||||
constructor(
|
constructor(
|
||||||
@Ancestor() segment: Segment,
|
@Ancestor() segment: Segment,
|
||||||
@NgElement() ngElement:NgElement,
|
|
||||||
elementRef: ElementRef,
|
elementRef: ElementRef,
|
||||||
renderer: Renderer
|
renderer: Renderer
|
||||||
) {
|
) {
|
||||||
this.domElement = ngElement.domElement
|
this.domElement = elementRef.domElement
|
||||||
this.segment = segment;
|
this.segment = segment;
|
||||||
|
|
||||||
segment.register(this);
|
segment.register(this);
|
||||||
|
@ -2,13 +2,14 @@ import {bootstrap} from 'angular2/angular2'
|
|||||||
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations';
|
||||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
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 {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms';
|
||||||
import {IONIC_DIRECTIVES} from 'ionic/ionic'
|
//import {IONIC_DIRECTIVES} from 'ionic/ionic'
|
||||||
|
|
||||||
@Component({ selector: 'ion-app' })
|
@Component({ selector: 'ion-app' })
|
||||||
@View({
|
@View({
|
||||||
templateUrl: 'main.html',
|
templateUrl: 'main.html',
|
||||||
directives: [FormDirectives].concat(IONIC_DIRECTIVES)
|
directives: [FormDirectives].concat([Segment, SegmentButton, Content, Button])
|
||||||
})
|
})
|
||||||
class IonicApp {
|
class IonicApp {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
Reference in New Issue
Block a user