mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
refactor(demos): forms and input
This commit is contained in:
24
demos/component-docs/labels/basic/pages.ts
Normal file
24
demos/component-docs/labels/basic/pages.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import {FORM_DIRECTIVES, FormBuilder, forwardRef, Validators, Control, ControlGroup} from 'angular2/angular2';
|
||||
import {Page} from 'ionic/ionic';
|
||||
import {AndroidAttribute} from '../../helpers';
|
||||
|
||||
@Page({
|
||||
templateUrl: 'labels/basic/template.html',
|
||||
providers: [FormBuilder],
|
||||
directives: [forwardRef(() => AndroidAttribute)]
|
||||
})
|
||||
export class BasicPage {
|
||||
|
||||
constructor() {
|
||||
this.form = new ControlGroup({
|
||||
firstName: new Control("", Validators.required),
|
||||
lastName: new Control("", Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
processForm(event) {
|
||||
// TODO: display input in a popup
|
||||
console.log(event);
|
||||
}
|
||||
|
||||
}
|
19
demos/component-docs/labels/basic/template.html
Normal file
19
demos/component-docs/labels/basic/template.html
Normal file
@ -0,0 +1,19 @@
|
||||
<ion-navbar *navbar hide-back-button class="show-navbar android-attr">
|
||||
<ion-title>Forms</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-content class="has-header components-demo">
|
||||
<form (submit)="processForm($event)" [ng-form-model]="form">
|
||||
<ion-list>
|
||||
<ion-input>
|
||||
<input ng-control="firstName" type="text" placeholder="First Name">
|
||||
</ion-input>
|
||||
<ion-input>
|
||||
<input ng-control="lastName" type="text" placeholder="Last Name">
|
||||
</ion-input>
|
||||
</ion-list>
|
||||
<div padding>
|
||||
<button block type="submit">Create Account</button>
|
||||
</div>
|
||||
</form>
|
||||
</ion-content>
|
Reference in New Issue
Block a user