From b88f6e37d98da3769bfb30b6bc4a1ec89d287b8b Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Sun, 29 Mar 2015 23:08:34 -0500 Subject: [PATCH] radio group --- src/components/radio/radio-button.js | 37 +++++++++++++ src/components/radio/radio-group.js | 33 ++++++++++++ src/components/radio/test/basic/main.html | 64 ++++------------------- src/components/radio/test/basic/main.js | 6 ++- 4 files changed, 85 insertions(+), 55 deletions(-) diff --git a/src/components/radio/radio-button.js b/src/components/radio/radio-button.js index e69de29bb2..dfbadb67db 100644 --- a/src/components/radio/radio-button.js +++ b/src/components/radio/radio-button.js @@ -0,0 +1,37 @@ +import {NgElement, Component, Template} from 'angular2/angular2' +import {ComponentConfig} from 'ionic2/config/component-config'; + +export let RadioConfig = new ComponentConfig('radio'); + +@Component({ + selector: 'ion-radio', + services: [RadioConfig] +}) +@Template({ + inline: ` +
+ +
+ +
+ +
+ + +
+ +
+ ` +}) +export class RadioButton { + constructor( + configFactory: RadioConfig, + element: NgElement + ) { + this.domElement = element.domElement + this.domElement.classList.add('item') + this.domElement.setAttribute('aria-checked', true) + + configFactory.create(this) + } +} diff --git a/src/components/radio/radio-group.js b/src/components/radio/radio-group.js index e69de29bb2..5b9c080170 100644 --- a/src/components/radio/radio-group.js +++ b/src/components/radio/radio-group.js @@ -0,0 +1,33 @@ +import {NgElement, Component, Template} from 'angular2/angular2' +import {ComponentConfig} from 'ionic2/config/component-config'; + +export let RadioConfig = new ComponentConfig('radio'); + +@Component({ + selector: 'ion-radio-group', + services: [RadioConfig] +}) +@Template({ + inline: ` +
+ +
+
+ +
+ + ` +}) +export class RadioGroup { + constructor( + configFactory: RadioConfig, + element: NgElement + ) { + this.domElement = element.domElement + this.domElement.classList.add('list') + this.domElement.classList.add('list-ios') + configFactory.create(this) + } +} diff --git a/src/components/radio/test/basic/main.html b/src/components/radio/test/basic/main.html index 34542ddfb4..ae97195982 100644 --- a/src/components/radio/test/basic/main.html +++ b/src/components/radio/test/basic/main.html @@ -5,68 +5,24 @@
-
+ -
+ Radio Group -
+ -
+ + Star Wars + - - - - -
- -
+
- diff --git a/src/components/radio/test/basic/main.js b/src/components/radio/test/basic/main.js index d0bbf22754..8d9dcf83a5 100644 --- a/src/components/radio/test/basic/main.js +++ b/src/components/radio/test/basic/main.js @@ -2,11 +2,15 @@ import {bootstrap} from 'angular2/core'; import {Component, Template} from 'angular2/angular2'; import {View} from 'ionic2/components/view/view'; import {Content} from 'ionic2/components/content/content'; +import {Icon} from 'ionic2/components/icon/icon'; +import {RadioGroup} from 'ionic2/components/radio/radio-group'; +import {RadioButton} from 'ionic2/components/radio/radio-button'; + @Component({ selector: '[ion-app]' }) @Template({ url: 'main.html', - directives: [View, Content] + directives: [View, Content, RadioGroup, RadioButton] }) class IonicApp { constructor() {