This commit is contained in:
Max Lynch
2015-05-07 20:36:32 -05:00
parent 57aaf7946e
commit 7f1e2dc5df
2 changed files with 17 additions and 6 deletions

View File

@ -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, {
}) })

View File

@ -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};