mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Segment
This commit is contained in:
@ -1,9 +1,18 @@
|
|||||||
import {NgElement, Decorator} from 'angular2/angular2'
|
import {NgElement, Component, View, Decorator} from 'angular2/angular2'
|
||||||
import {IonicComponent} from 'ionic/config/component'
|
import {IonicComponent} from 'ionic/config/component'
|
||||||
|
import {Button} from 'ionic/components/button/button'
|
||||||
|
|
||||||
@Decorator({
|
|
||||||
|
@Component({
|
||||||
selector: 'ion-segment'
|
selector: 'ion-segment'
|
||||||
})
|
})
|
||||||
|
@View({
|
||||||
|
template: `<div class="ion-segment" (^click)="buttonClicked($event)">
|
||||||
|
<content></content>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
directives: [Button]
|
||||||
|
})
|
||||||
export class Segment {
|
export class Segment {
|
||||||
constructor(
|
constructor(
|
||||||
@NgElement() ngElement:NgElement
|
@NgElement() ngElement:NgElement
|
||||||
@ -11,6 +20,10 @@ export class Segment {
|
|||||||
this.domElement = ngElement.domElement
|
this.domElement = ngElement.domElement
|
||||||
this.config = Button.config.invoke(this)
|
this.config = Button.config.invoke(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buttonClicked(event) {
|
||||||
|
console.log('Button clicked', event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
new IonicComponent(Segment, {
|
new IonicComponent(Segment, {
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import {Button, Switch, List, Label, Item, Input, Content} from 'ionic/ionic';
|
import {Button, Switch, List, Label, Item, Input, Content, Segment} from 'ionic/ionic';
|
||||||
var IONIC_DIRECTIVES = [Button, List, Label, Item, Content];
|
var IONIC_DIRECTIVES = [Button, List, Label, Item, Content, Segment];
|
||||||
|
|
||||||
console.log('DIRECTIVES', IONIC_DIRECTIVES);
|
|
||||||
|
|
||||||
export {IONIC_DIRECTIVES};
|
export {IONIC_DIRECTIVES};
|
||||||
|
Reference in New Issue
Block a user