mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
chore(): begin adding ionic components to mono-repo.
This commit is contained in:
@ -0,0 +1,9 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { PageOne } from '../pages/page-one/page-one';
|
||||
|
||||
@Component({
|
||||
template: '<ion-nav [root]="root"></ion-nav>'
|
||||
})
|
||||
export class AppComponent {
|
||||
root = PageOne;
|
||||
}
|
19
packages/ionic-angular/demos/src/alert/app/app.module.ts
Normal file
19
packages/ionic-angular/demos/src/alert/app/app.module.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { IonicApp, IonicModule } from '../../../../src';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { PageOneModule } from '../pages/page-one/page-one.module';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
IonicModule.forRoot(AppComponent),
|
||||
PageOneModule
|
||||
],
|
||||
bootstrap: [IonicApp]
|
||||
})
|
||||
export class AppModule {}
|
5
packages/ionic-angular/demos/src/alert/app/main.ts
Normal file
5
packages/ionic-angular/demos/src/alert/app/main.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
@ -0,0 +1,18 @@
|
||||
<ion-header>
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title>Alert</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<ion-button block (click)="doAlert()">Basic Alert</ion-button>
|
||||
<ion-button color="light" block (click)="doConfirm()">Confirm Alert</ion-button>
|
||||
<ion-button color="secondary" block (click)="doPrompt()">Prompt Alert</ion-button>
|
||||
<ion-button color="danger" block (click)="doRadio()">Radio Alert</ion-button>
|
||||
<ion-button color="dark" block (click)="doCheckbox()">Checkbox Alert</ion-button>
|
||||
|
||||
</ion-content>
|
@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { IonicPageModule } from '../../../../../src';
|
||||
|
||||
import { PageOne } from './page-one';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
PageOne,
|
||||
],
|
||||
imports: [
|
||||
IonicPageModule.forChild(PageOne),
|
||||
],
|
||||
entryComponents: [
|
||||
PageOne,
|
||||
]
|
||||
})
|
||||
export class PageOneModule {}
|
@ -0,0 +1,209 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { AlertController } from '../../../../../src';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'page-one.html'
|
||||
})
|
||||
export class PageOne {
|
||||
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) => {
|
||||
console.log('Cancel clicked');
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Save',
|
||||
handler: (data) => {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user