mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
BGutton click
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import {NgFor} from 'angular2/angular2';
|
import {NgFor, NgIf} from 'angular2/angular2';
|
||||||
import {Ancestor} from 'angular2/src/core/annotations_impl/visibility';
|
import {Ancestor} from 'angular2/src/core/annotations_impl/visibility';
|
||||||
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';
|
||||||
@ -23,7 +23,7 @@ import {Routable, NavbarTemplate, Navbar, NavController, Button, Content} from '
|
|||||||
and those that flow inline), and shapes.
|
and those that flow inline), and shapes.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<div>
|
<div (^click)="onButtonClick($event)">
|
||||||
<button primary>Primary</button>
|
<button primary>Primary</button>
|
||||||
<button secondary>Secondary</button>
|
<button secondary>Secondary</button>
|
||||||
<button stable>Stable</button>
|
<button stable>Stable</button>
|
||||||
@ -31,17 +31,30 @@ import {Routable, NavbarTemplate, Navbar, NavController, Button, Content} from '
|
|||||||
<button dark>Dark</button>
|
<button dark>Dark</button>
|
||||||
<button danger>Danger</button>
|
<button danger>Danger</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ng-if="clicked">
|
||||||
|
<b>CLICKED</b>
|
||||||
|
</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
`,
|
`,
|
||||||
directives: [NavbarTemplate, Navbar, Content, Button]
|
directives: [NavbarTemplate, Navbar, Content, Button, NgIf]
|
||||||
})
|
})
|
||||||
export class ButtonPage {
|
export class ButtonPage {
|
||||||
constructor(nav: NavController) {
|
constructor(nav: NavController) {
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
window.nav = nav;
|
window.nav = nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onButtonClick(event) {
|
||||||
|
console.log('On button click', event);
|
||||||
|
|
||||||
|
clearTimeout(this.clickTimeout);
|
||||||
|
this.clicked = true;
|
||||||
|
this.clickTimeout = setTimeout(() => {
|
||||||
|
this.clicked = false;
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new Routable(ButtonPage, {
|
new Routable(ButtonPage, {
|
||||||
|
@ -10,7 +10,7 @@ import {Segment, SegmentButton, SearchBar, List, Item, ActionMenu, Modal, ModalR
|
|||||||
console.log(NavbarTemplate, Navbar, Content, formDirectives);
|
console.log(NavbarTemplate, Navbar, Content, formDirectives);
|
||||||
|
|
||||||
function randomTitle() {
|
function randomTitle() {
|
||||||
var items = ['Pizza', 'Pumpkin', 'Apple', 'Bologna'];
|
var items = ['Pizza', 'Pumpkin', 'Apple', 'Bologna', 'Durian', 'Banana', 'Meat pie'];
|
||||||
return items[Math.floor(Math.random() * items.length)];
|
return items[Math.floor(Math.random() * items.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user