mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
refactor(demo): move the demo app
This commit is contained in:
58
packages/demos/angular/src/app/alert/alert-page.component.ts
Normal file
58
packages/demos/angular/src/app/alert/alert-page.component.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
import { AlertController } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-alert-page',
|
||||
template: `
|
||||
<ion-app>
|
||||
<ion-page class="show-page">
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-title>Test</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content padding>
|
||||
<ion-button (click)="clickMe()">Open Basic Alert</ion-button>
|
||||
</ion-content>
|
||||
</ion-page>
|
||||
</ion-app>
|
||||
`
|
||||
})
|
||||
export class AlertPageComponent {
|
||||
|
||||
constructor(private alertController: AlertController) {
|
||||
|
||||
}
|
||||
|
||||
clickMe() {
|
||||
const alert = this.alertController.create({
|
||||
title: 'ohhhh snap',
|
||||
message: 'Ive been injected via Angular keeping the old api',
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancel',
|
||||
role: 'Cancel',
|
||||
handler: () => {
|
||||
// console.log('cancel');
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Okay',
|
||||
role: 'Okay',
|
||||
handler: () => {
|
||||
// console.log('okay');
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
});
|
||||
alert.present().then(() => {
|
||||
return alert.dismiss();
|
||||
|
||||
}).then(() => {
|
||||
console.log('dismissed');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
14
packages/demos/angular/src/app/alert/alert-routing.module.ts
Normal file
14
packages/demos/angular/src/app/alert/alert-routing.module.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { AlertPageComponent } from './alert-page.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: AlertPageComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AlertRoutingModule { }
|
15
packages/demos/angular/src/app/alert/alert.module.ts
Normal file
15
packages/demos/angular/src/app/alert/alert.module.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { AlertPageComponent } from './alert-page.component';
|
||||
import { AlertRoutingModule } from './alert-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
AlertRoutingModule
|
||||
],
|
||||
declarations: [AlertPageComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class AlertModule { }
|
16
packages/demos/angular/src/app/app-routing.module.ts
Normal file
16
packages/demos/angular/src/app/app-routing.module.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||
{ path: 'basic-inputs', loadChildren: 'app/basic-inputs-page/basic-inputs-page.module#BasicInputsPageModule' },
|
||||
{ path: 'group-inputs', loadChildren: 'app/group-inputs-page/group-inputs-page.module#GroupInputsPageModule' },
|
||||
{ path: 'home', loadChildren: 'app/home-page/home-page.module#HomePageModule' },
|
||||
{ path: 'alert', loadChildren: 'app/alert/alert.module#AlertModule' }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class AppRoutingModule { }
|
0
packages/demos/angular/src/app/app.component.css
Normal file
0
packages/demos/angular/src/app/app.component.css
Normal file
2
packages/demos/angular/src/app/app.component.html
Normal file
2
packages/demos/angular/src/app/app.component.html
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
<router-outlet></router-outlet>
|
20
packages/demos/angular/src/app/app.component.spec.ts
Normal file
20
packages/demos/angular/src/app/app.component.spec.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
|
||||
import { RouterOutletStubComponent } from '../../testing/router-stubs';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach( async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [AppComponent, RouterOutletStubComponent]
|
||||
}).compileComponents();
|
||||
})
|
||||
);
|
||||
|
||||
it('should create the app', async(() => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
})
|
||||
);
|
||||
});
|
10
packages/demos/angular/src/app/app.component.ts
Normal file
10
packages/demos/angular/src/app/app.component.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
export class AppComponent {
|
||||
title = 'app';
|
||||
}
|
21
packages/demos/angular/src/app/app.module.ts
Normal file
21
packages/demos/angular/src/app/app.module.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
import { AlertController } from '@ionic/angular';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppComponent],
|
||||
imports: [
|
||||
AppRoutingModule,
|
||||
BrowserModule,
|
||||
],
|
||||
providers: [
|
||||
AlertController
|
||||
],
|
||||
bootstrap: [AppComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class AppModule {}
|
@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { BasicInputsPageComponent } from './basic-inputs-page.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: BasicInputsPageComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class BasicInputsPageRoutingModule { }
|
@ -0,0 +1,138 @@
|
||||
<div class="title">
|
||||
Ionic Core Basic Inputs Demo
|
||||
</div>
|
||||
|
||||
<ion-grid>
|
||||
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Text Input</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<label for="stdTextInput">Standard Input</label>
|
||||
<input id="stdTextInput" name="stdTextInput" [(ngModel)]="textValue" minlength="10" />
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
Value:
|
||||
<span id="textOutput">{{textValue}}</span>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-item>
|
||||
<ion-label>Ionic Text Input</ion-label>
|
||||
<ion-input id="ionTextInput" name="ionTextInput" [(ngModel)]="textValue" minlength="10" (ionBlur)="onBlur($event)"></ion-input>
|
||||
</ion-item>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Textarea Input</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<label for="stdTextareaInput">Standard Textarea Input</label>
|
||||
<textarea id="stdTextareaInput" name="stdTextareaInput" [(ngModel)]="textareaValue" minlength="10"></textarea>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
Value:
|
||||
<span id="textareaOutput">{{textareaValue}}</span>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-item>
|
||||
<ion-label>Ionic Textarea Input</ion-label>
|
||||
<ion-textarea id="ionTextareaInput" name="ionTextareaInput" [(ngModel)]="textareaValue" minlength="10" (ionBlur)="onBlur($event)"></ion-textarea>
|
||||
</ion-item>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Checkbox</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<label for="stdCheckbox">Standard Checkbox</label>
|
||||
<input type="checkbox" id="stdCheckbox" name="stdCheckbox" [(ngModel)]="checkboxValue" (blur)="onBlur($event)" />
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
Value:
|
||||
<span id="checkboxOutput">{{checkboxValue}}</span>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-item>
|
||||
<ion-label>Ionic Checkbox</ion-label>
|
||||
<ion-checkbox id="ionCheckbox" name="ionCheckbox" [(ngModel)]="checkboxValue" (ionBlur)="onBlur($event)"></ion-checkbox>
|
||||
</ion-item>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Toggle</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<label for="stdToggle">Standard Toggle</label>
|
||||
<input type="checkbox" id="stdToggle" name="stdToggle" [(ngModel)]="toggleValue" (blur)="onBlur($event)" />
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
Value:
|
||||
<span id="toggleOutput">{{toggleValue}}</span>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-item>
|
||||
<ion-label>Ionic Toggle</ion-label>
|
||||
<ion-toggle id="ionToggle" name="ionToggle" [(ngModel)]="toggleValue" (ionBlur)="onBlur($event)"></ion-toggle>
|
||||
</ion-item>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Date Time Picker</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<label for="stdToggle">ISO Formatted Date</label>
|
||||
<input id="stdDatetimeInput" name="stdDatetimeInput" [(ngModel)]="datetimeValue" placeholder="YYYY-MM-DDTHH:mm:ssZ" />
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
Value:
|
||||
<span id="datetimeOutput">{{datetimeValue}}</span>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-item>
|
||||
<ion-label>Ionic Date</ion-label>
|
||||
<ion-datetime id="ionDatetimeInput" pickerFormat="YYYY-MM-DD HH:mm:ss" displayFormat="MM/DD/YYYY HH:mm:ss" name="ionDatetimeInput" [(ngModel)]="datetimeValue"></ion-datetime>
|
||||
</ion-item>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</ion-grid>
|
||||
|
||||
<a href='home'>Home</a>
|
@ -0,0 +1,55 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { BasicInputsPageComponent } from './basic-inputs-page.component';
|
||||
|
||||
describe('InputsTestPageComponent', () => {
|
||||
let component: BasicInputsPageComponent;
|
||||
let fixture: ComponentFixture<BasicInputsPageComponent>;
|
||||
|
||||
beforeEach(
|
||||
async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [BasicInputsPageComponent],
|
||||
imports: [FormsModule, SharedModule],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
})
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BasicInputsPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
describe('testInputOne binding', () => {
|
||||
let input;
|
||||
beforeEach(
|
||||
fakeAsync(() => {
|
||||
component.ngOnInit();
|
||||
fixture.detectChanges();
|
||||
tick();
|
||||
input = fixture.debugElement.query(By.css('#stdTextInput')).nativeElement;
|
||||
// This is what I ultimtely want to test...
|
||||
//
|
||||
// const ionInput = fixture.debugElement.query(By.css('#ionTextInput'));
|
||||
// input = ionInput.query(By.css('input')).nativeElement;
|
||||
})
|
||||
);
|
||||
|
||||
it('should reflect changes to the input', () => {
|
||||
expect(input).toBeTruthy();
|
||||
input.value = 'Frank';
|
||||
input.dispatchEvent(new Event('input'));
|
||||
expect(component.textValue).toEqual('Frank');
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-basic-inputs-page',
|
||||
templateUrl: './basic-inputs-page.component.html',
|
||||
styleUrls: ['./basic-inputs-page.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class BasicInputsPageComponent implements OnInit {
|
||||
datetimeValue = '2017-11-18T14:17:45-06:00';
|
||||
textareaValue = 'This is the Textarea Input';
|
||||
textValue = 'This is the Text Input';
|
||||
|
||||
checkboxValue = true;
|
||||
toggleValue = false;
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
onBlur(evt) {
|
||||
console.log('blur: ', evt);
|
||||
}
|
||||
|
||||
change(evt) {
|
||||
console.log('change: ', evt);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { IonicAngularModule } from '@ionic/angular';
|
||||
|
||||
import { BasicInputsPageComponent } from './basic-inputs-page.component';
|
||||
import { BasicInputsPageRoutingModule } from './basic-inputs-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BasicInputsPageRoutingModule,
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicAngularModule
|
||||
],
|
||||
declarations: [BasicInputsPageComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class BasicInputsPageModule {}
|
@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { GroupInputsPageComponent } from './group-inputs-page.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: GroupInputsPageComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class GroupInputsPageRoutingModule { }
|
@ -0,0 +1,158 @@
|
||||
<div class="title">
|
||||
Ionic Core Group Inputs Demo
|
||||
</div>
|
||||
|
||||
<ion-grid>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Radio Buttons</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h3>Angular</h3>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<input id="stdBeef" type="radio" value="beef" [(ngModel)]="radioValue" />
|
||||
<label for="stdBeef">Carne Asada</label>
|
||||
<input id="stdTongue" type="radio" value="tongue" [(ngModel)]="radioValue" />
|
||||
<label for="stdTongue">Lengua</label>
|
||||
<input id="stdBrains" type="radio" value="brains" [(ngModel)]="radioValue" />
|
||||
<label for="stdBrains">Sesos</label>
|
||||
<input id="stdTripe" type="radio" value="tripe" [(ngModel)]="radioValue" />
|
||||
<label for="stdTripe">Tripa</label>
|
||||
<input id="stdChicken" type="radio" value="chicken" [(ngModel)]="radioValue" />
|
||||
<label for="stdChicken">Pollo</label>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
Value:
|
||||
<span id="radioOutput">{{radioValue}}</span>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h3>Ionic With Radio Group</h3>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-list>
|
||||
<ion-radio-group id="radio-group" [(ngModel)]="radioValue">
|
||||
<ion-item>
|
||||
<ion-label>Crarne Asada</ion-label>
|
||||
<ion-radio id="ion-grp-beef" value="beef"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Lengua</ion-label>
|
||||
<ion-radio id="ion-grp-tongue" value="tongue"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Sesos</ion-label>
|
||||
<ion-radio id="ion-grp-brains" value="brains"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Tripa</ion-label>
|
||||
<ion-radio id="ion-grp-tripe" value="tripe"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Pollo</ion-label>
|
||||
<ion-radio id="ion-grp-chicken" value="chicken"></ion-radio>
|
||||
</ion-item>
|
||||
</ion-radio-group>
|
||||
</ion-list>
|
||||
</ion-col>
|
||||
<ion-col></ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h3>Ionic Without Radio Group</h3>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
<ion-label>Crarne Asada</ion-label>
|
||||
<ion-radio value="beef" id="ion-beef" name="tacos" [(ngModel)]="radioValue"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Lengua</ion-label>
|
||||
<ion-radio value="tongue" id="ion-tongue" name="tacos" [(ngModel)]="radioValue"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Sesos</ion-label>
|
||||
<ion-radio value="brains" id="ion-brains" name="tacos" [(ngModel)]="radioValue"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Tripa</ion-label>
|
||||
<ion-radio value="tripe" id="ion-tripe" name="tacos" [(ngModel)]="radioValue"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Pollo</ion-label>
|
||||
<ion-radio value="chicken" id="ion-chicken" name="tacos" [(ngModel)]="radioValue"></ion-radio>
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-col>
|
||||
<ion-col></ion-col>
|
||||
</ion-row>
|
||||
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Ionic Segment</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-segment id="segment" color="primary" [(ngModel)]="radioValue">
|
||||
<ion-segment-button value="beef" id="ion-seg-beef">Carne Asada</ion-segment-button>
|
||||
<ion-segment-button value="tongue" id="ion-seg-tongue">Lengua</ion-segment-button>
|
||||
<ion-segment-button value="brains" id="ion-seg-brains">Sesos</ion-segment-button>
|
||||
<ion-segment-button value="tripe" id="ion-seg-tripe">Tripa</ion-segment-button>
|
||||
<ion-segment-button value="chicken" id="ion-seg-chicken">Pollo</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-col>
|
||||
<ion-col></ion-col>
|
||||
</ion-row>
|
||||
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<h2>Select</h2>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<label for="stdSelect">Standard Select (for tacos)</label>
|
||||
<select id="stdSelect" name="stdSelect" [(ngModel)]="selectValue">
|
||||
<option value="beef">Carne Asada</option>
|
||||
<option value="tongue">Lengua</option>
|
||||
<option value="brains">Sesos</option>
|
||||
<option value="tripe">Tripa</option>
|
||||
<option value="chicken">Pollo</option>
|
||||
</select>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
Value:
|
||||
<span id="selectOutput">{{selectValue}}</span>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
<ion-row>
|
||||
<ion-col>
|
||||
<ion-item>
|
||||
<ion-label>Ionic Select (for tacos)</ion-label>
|
||||
<ion-select id="ionSelect" name="ionSelect" [(ngModel)]="selectValue">
|
||||
<ion-select-option value="beef">Carne Asada</ion-select-option>
|
||||
<ion-select-option value="tongue">Lengua</ion-select-option>
|
||||
<ion-select-option value="brains">Sesos</ion-select-option>
|
||||
<ion-select-option value="tripe">Tripa</ion-select-option>
|
||||
<ion-select-option value="chicken">Pollo</ion-select-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
|
||||
</ion-grid>
|
||||
<a href='home'>Home</a>
|
@ -0,0 +1,31 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { GroupInputsPageComponent } from './group-inputs-page.component';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
describe('GroupInputsPageComponent', () => {
|
||||
let component: GroupInputsPageComponent;
|
||||
let fixture: ComponentFixture<GroupInputsPageComponent>;
|
||||
|
||||
beforeEach(
|
||||
async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [FormsModule, SharedModule],
|
||||
declarations: [GroupInputsPageComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
})
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(GroupInputsPageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-inputs-page',
|
||||
templateUrl: './group-inputs-page.component.html',
|
||||
styleUrls: ['./group-inputs-page.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class GroupInputsPageComponent implements OnInit {
|
||||
radioValue = 'tripe';
|
||||
selectValue = 'brains';
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { IonicAngularModule } from '@ionic/angular';
|
||||
|
||||
import { GroupInputsPageComponent } from './group-inputs-page.component';
|
||||
import { GroupInputsPageRoutingModule } from './group-inputs-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
GroupInputsPageRoutingModule,
|
||||
IonicAngularModule
|
||||
],
|
||||
declarations: [GroupInputsPageComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class GroupInputsPageModule {}
|
@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { HomePageComponent } from './home-page.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', component: HomePageComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class HomePageRoutingModule { }
|
@ -0,0 +1,15 @@
|
||||
<div class='title'>
|
||||
Ionic Core Angular Demo Application
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a href='basic-inputs'>Basic Inputs Test Page</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='group-inputs'>Group Inputs Test Page</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='alert'>Alert Page</a>
|
||||
</li>
|
||||
</ul>
|
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HomePageComponent } from './home-page.component';
|
||||
|
||||
describe('HomePageComponent', () => {
|
||||
let component: HomePageComponent;
|
||||
let fixture: ComponentFixture<HomePageComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HomePageComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HomePageComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home-page',
|
||||
templateUrl: './home-page.component.html',
|
||||
styleUrls: ['./home-page.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class HomePageComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() { }
|
||||
|
||||
}
|
14
packages/demos/angular/src/app/home-page/home-page.module.ts
Normal file
14
packages/demos/angular/src/app/home-page/home-page.module.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { HomePageComponent } from './home-page.component';
|
||||
import { HomePageRoutingModule } from './home-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
HomePageRoutingModule
|
||||
],
|
||||
declarations: [HomePageComponent]
|
||||
})
|
||||
export class HomePageModule { }
|
0
packages/demos/angular/src/assets/.gitkeep
Normal file
0
packages/demos/angular/src/assets/.gitkeep
Normal file
@ -0,0 +1,3 @@
|
||||
export const environment = {
|
||||
production: true
|
||||
};
|
8
packages/demos/angular/src/environments/environment.ts
Normal file
8
packages/demos/angular/src/environments/environment.ts
Normal file
@ -0,0 +1,8 @@
|
||||
// The file contents for the current environment will overwrite these during build.
|
||||
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
BIN
packages/demos/angular/src/favicon.ico
Normal file
BIN
packages/demos/angular/src/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
15
packages/demos/angular/src/index.html
Normal file
15
packages/demos/angular/src/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Demo</title>
|
||||
<base href="/">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<script src="ionic/core/ionic.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
12
packages/demos/angular/src/main.ts
Normal file
12
packages/demos/angular/src/main.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.log(err));
|
76
packages/demos/angular/src/polyfills.ts
Normal file
76
packages/demos/angular/src/polyfills.ts
Normal file
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/weak-map';
|
||||
// import 'core-js/es6/set';
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/** IE10 and IE11 requires the following for the Reflect API. */
|
||||
// import 'core-js/es6/reflect';
|
||||
|
||||
|
||||
/** Evergreen browsers require these. **/
|
||||
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
||||
import 'core-js/es7/reflect';
|
||||
|
||||
|
||||
/**
|
||||
* Required to support Web Animations `@angular/platform-browser/animations`.
|
||||
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
||||
**/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
|
||||
/**
|
||||
* Date, currency, decimal and percent pipes.
|
||||
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
||||
*/
|
||||
// import 'intl'; // Run `npm install --save intl`.
|
||||
/**
|
||||
* Need to import at least one locale-data with intl.
|
||||
*/
|
||||
// import 'intl/locale-data/jsonp/en';
|
3
packages/demos/angular/src/styles.scss
Normal file
3
packages/demos/angular/src/styles.scss
Normal file
@ -0,0 +1,3 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
|
||||
// @import '~@ionic/core/src/themes/ionic.build.default';
|
32
packages/demos/angular/src/test.ts
Normal file
32
packages/demos/angular/src/test.ts
Normal file
@ -0,0 +1,32 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/long-stack-trace-zone';
|
||||
import 'zone.js/dist/proxy.js';
|
||||
import 'zone.js/dist/sync-test';
|
||||
import 'zone.js/dist/jasmine-patch';
|
||||
import 'zone.js/dist/async-test';
|
||||
import 'zone.js/dist/fake-async-test';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
||||
declare const __karma__: any;
|
||||
declare const require: any;
|
||||
|
||||
// Prevent Karma from running prematurely.
|
||||
__karma__.loaded = function () {};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
// Finally, start Karma to run the tests.
|
||||
__karma__.start();
|
13
packages/demos/angular/src/tsconfig.app.json
Normal file
13
packages/demos/angular/src/tsconfig.app.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"baseUrl": "./",
|
||||
"module": "es2015",
|
||||
"types": []
|
||||
},
|
||||
"exclude": [
|
||||
"test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
20
packages/demos/angular/src/tsconfig.spec.json
Normal file
20
packages/demos/angular/src/tsconfig.spec.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"baseUrl": "./",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
5
packages/demos/angular/src/typings.d.ts
vendored
Normal file
5
packages/demos/angular/src/typings.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/* SystemJS module definition */
|
||||
declare var module: NodeModule;
|
||||
interface NodeModule {
|
||||
id: string;
|
||||
}
|
Reference in New Issue
Block a user