mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-24 14:58:36 +08:00

* chore(build): WIP getting ionic working with app-scripts the tsconfig file change is just for testing, this will need to be undone * chore(demos): update tsconfig and gitignore for demos update tsconfig and gitinogre for demos * chore(build): WIP check in progress with building with app-scripts this only works with demos/action-sheet currently * refactor(demos): add custom copy config add custom copy config * chore(tsconfig): revert root tsconfig * chore(demos): change import paths * chore(demos): move sass config, add new tsconfig, update template * chore(scripts): update demos tasks to use app scripts with folder name tweak the createTempTsConfig function to include a path to read from, move getFolderInfo into util to share at this point you should be able to run `gulp demos.prod` with a folder e.g. `--f=alert` and open the index of that test to see it. Doesn’t work yet with all of the tests at once. Need to have ran `gulp release.prepareReleasePackage` first. * chore(build): WIP working on getting all of the demos building * chore(demos): update demos task for app-scripts build * chore(demos): fix tslint errors thrown by app-scripts * chore(demos): get the demos working with fonts and variable file * chore(demos): add watch task to the new prod task * chore(demos): remove old demos.prod file and rename new one to it * chore(npm): remove build npm script * chore(demos): only log component name in url if one was passed
233 lines
4.3 KiB
TypeScript
233 lines
4.3 KiB
TypeScript
import { Component, NgModule } from '@angular/core';
|
|
import { AlertController, IonicApp, IonicModule } from '../../ionic-angular';
|
|
|
|
|
|
@Component({
|
|
templateUrl: 'page.html'
|
|
})
|
|
export class ApiDemoPage {
|
|
testRadioOpen = false;
|
|
testRadioResult: any;
|
|
testCheckboxOpen = false;
|
|
testCheckboxResult: any;
|
|
|
|
constructor(public alertCtrl: AlertController) {}
|
|
|
|
doAlert() {
|
|
let alert = this.alertCtrl.create({
|
|
title: 'New Friend!',
|
|
subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
|
|
buttons: ['Ok']
|
|
});
|
|
|
|
alert.present();
|
|
}
|
|
|
|
doConfirm() {
|
|
let alert = this.alertCtrl.create({
|
|
title: 'Use this lightsaber?',
|
|
message: 'Do you agree to use this lightsaber to do good across the intergalactic galaxy?',
|
|
buttons: [
|
|
{
|
|
text: 'Disagree',
|
|
handler: () => {
|
|
console.log('Disagree clicked');
|
|
}
|
|
},
|
|
{
|
|
text: 'Agree',
|
|
handler: () => {
|
|
console.log('Agree clicked');
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
alert.present();
|
|
}
|
|
|
|
doPrompt() {
|
|
let alert = this.alertCtrl.create({
|
|
title: 'Login',
|
|
message: 'Enter a name for this new album you\'re so keen on adding',
|
|
inputs: [
|
|
{
|
|
name: 'title',
|
|
placeholder: 'Title'
|
|
},
|
|
],
|
|
buttons: [
|
|
{
|
|
text: 'Cancel',
|
|
handler: (data: any) => {
|
|
console.log('Cancel clicked');
|
|
}
|
|
},
|
|
{
|
|
text: 'Save',
|
|
handler: (data: any) => {
|
|
console.log('Saved clicked');
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
alert.present();
|
|
}
|
|
|
|
doRadio() {
|
|
let alert = this.alertCtrl.create();
|
|
alert.setTitle('Lightsaber color');
|
|
|
|
alert.addInput({
|
|
type: 'radio',
|
|
label: 'Blue',
|
|
value: 'blue',
|
|
checked: true
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'radio',
|
|
label: 'Green',
|
|
value: 'green'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'radio',
|
|
label: 'Red',
|
|
value: 'red'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'radio',
|
|
label: 'Yellow',
|
|
value: 'yellow'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'radio',
|
|
label: 'Purple',
|
|
value: 'purple'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'radio',
|
|
label: 'White',
|
|
value: 'white'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'radio',
|
|
label: 'Black',
|
|
value: 'black'
|
|
});
|
|
|
|
alert.addButton('Cancel');
|
|
alert.addButton({
|
|
text: 'Ok',
|
|
handler: (data: any) => {
|
|
console.log('Radio data:', data);
|
|
this.testRadioOpen = false;
|
|
this.testRadioResult = data;
|
|
}
|
|
});
|
|
|
|
alert.present();
|
|
}
|
|
|
|
doCheckbox() {
|
|
let alert = this.alertCtrl.create();
|
|
alert.setTitle('Which planets have you visited?');
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Alderaan',
|
|
value: 'value1',
|
|
checked: true
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Bespin',
|
|
value: 'value2'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Coruscant',
|
|
value: 'value3'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Endor',
|
|
value: 'value4'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Hoth',
|
|
value: 'value5'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Jakku',
|
|
value: 'value6'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Naboo',
|
|
value: 'value6'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Takodana',
|
|
value: 'value6'
|
|
});
|
|
|
|
alert.addInput({
|
|
type: 'checkbox',
|
|
label: 'Tatooine',
|
|
value: 'value6'
|
|
});
|
|
|
|
alert.addButton('Cancel');
|
|
alert.addButton({
|
|
text: 'Okay',
|
|
handler: (data: any) => {
|
|
console.log('Checkbox data:', data);
|
|
this.testCheckboxOpen = false;
|
|
this.testCheckboxResult = data;
|
|
}
|
|
});
|
|
|
|
alert.present();
|
|
}
|
|
|
|
}
|
|
|
|
@Component({
|
|
template: `<ion-nav [root]="root"></ion-nav>`
|
|
})
|
|
export class ApiDemoApp {
|
|
root = ApiDemoPage;
|
|
}
|
|
|
|
@NgModule({
|
|
declarations: [
|
|
ApiDemoApp,
|
|
ApiDemoPage
|
|
],
|
|
imports: [
|
|
IonicModule.forRoot(ApiDemoApp)
|
|
],
|
|
bootstrap: [IonicApp],
|
|
entryComponents: [
|
|
ApiDemoPage
|
|
]
|
|
})
|
|
export class AppModule {}
|