mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-09 08:09:32 +08:00
feat(demo): add group inputs page
This commit is contained in:
@ -3,8 +3,9 @@ import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||
{ path: 'basic-inputs', loadChildren: 'app/basic-inputs/basic-inputs.module#BasicInputsModule' },
|
||||
{ path: 'home', loadChildren: 'app/home/home.module#HomeModule' }
|
||||
{ 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' }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@ -11,4 +11,4 @@ const routes: Routes = [
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class BasicInputsRoutingModule { }
|
||||
export class BasicInputsPageRoutingModule { }
|
||||
@ -4,11 +4,11 @@ import { CommonModule } from '@angular/common';
|
||||
import { BasicInputsPageComponent } from './basic-inputs-page.component';
|
||||
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
import { BasicInputsRoutingModule } from './basic-inputs-routing.module';
|
||||
import { BasicInputsPageRoutingModule } from './basic-inputs-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, FormsModule, BasicInputsRoutingModule, SharedModule],
|
||||
imports: [CommonModule, FormsModule, BasicInputsPageRoutingModule, SharedModule],
|
||||
declarations: [BasicInputsPageComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class BasicInputsModule {}
|
||||
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,60 @@
|
||||
<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>
|
||||
<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>
|
||||
<ion-list>
|
||||
<ion-radio-group [{ngModel}]="radioValue">
|
||||
<ion-item>
|
||||
<ion-label>Crarne Asada</ion-label>
|
||||
<ion-radio value="beef"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Lengua</ion-label>
|
||||
<ion-radio value="tongue"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Sesos</ion-label>
|
||||
<ion-radio value="brains"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Tripa</ion-label>
|
||||
<ion-radio value="tripe"></ion-radio>
|
||||
</ion-item>
|
||||
<ion-item>
|
||||
<ion-label>Pollo</ion-label>
|
||||
<ion-radio value="chicken"></ion-radio>
|
||||
</ion-item>
|
||||
</ion-radio-group>
|
||||
</ion-list>
|
||||
</ion-col>
|
||||
<ion-col></ion-col>
|
||||
</ion-row>
|
||||
|
||||
</ion-grid>
|
||||
<a href='home'>Home</a>
|
||||
@ -0,0 +1,28 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { GroupInputsPageComponent } from './group-inputs-page.component';
|
||||
|
||||
describe('GroupInputsPageComponent', () => {
|
||||
let component: GroupInputsPageComponent;
|
||||
let fixture: ComponentFixture<GroupInputsPageComponent>;
|
||||
|
||||
beforeEach(
|
||||
async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
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,15 @@
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-inputs-page',
|
||||
templateUrl: './group-inputs-page.component.html',
|
||||
styleUrls: ['./group-inputs-page.component.css'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class GroupInputsPageComponent implements OnInit {
|
||||
radioValue = 'tripe';
|
||||
|
||||
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 { GroupInputsPageComponent } from './group-inputs-page.component';
|
||||
import { GroupInputsPageRoutingModule } from './group-inputs-page-routing.module';
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
GroupInputsPageRoutingModule,
|
||||
SharedModule
|
||||
],
|
||||
declarations: [GroupInputsPageComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
export class GroupInputsPageModule {}
|
||||
@ -11,4 +11,4 @@ const routes: Routes = [
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule]
|
||||
})
|
||||
export class HomeRoutingModule { }
|
||||
export class HomePageRoutingModule { }
|
||||
@ -0,0 +1,12 @@
|
||||
<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>
|
||||
</ul>
|
||||
@ -2,13 +2,13 @@ import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { HomePageComponent } from './home-page.component';
|
||||
import { HomeRoutingModule } from './home-routing.module';
|
||||
import { HomePageRoutingModule } from './home-page-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
HomeRoutingModule
|
||||
HomePageRoutingModule
|
||||
],
|
||||
declarations: [HomePageComponent]
|
||||
})
|
||||
export class HomeModule { }
|
||||
export class HomePageModule { }
|
||||
@ -1,5 +0,0 @@
|
||||
<div class='title'>
|
||||
Ionic Core Angular Demo Application
|
||||
</div>
|
||||
|
||||
<a href='basic-inputs'>Basic Inputs Test Page</a>
|
||||
@ -6,7 +6,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||
// https://github.com/angular/angular/blob/5.0.2/packages/forms/src/directives/select_control_value_accessor.ts#L28-L158
|
||||
@Directive({
|
||||
/* tslint:disable-next-line:directive-selector */
|
||||
selector: 'ion-select',
|
||||
selector: 'ion-select,ion-radio-group',
|
||||
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: IonSelectValueAccessorDirective, multi: true }]
|
||||
})
|
||||
export class IonSelectValueAccessorDirective implements ControlValueAccessor {
|
||||
|
||||
Reference in New Issue
Block a user