728x90
반응형
꼭 라디오버튼이 아니더라도,, ion-chip이나 ion-checkbox에도 활용할수 있다.
radio 버튼에서 주의할 점은 ion-radio-group으로 묶어주는 것과 ion-radio의 name을 통일시켜주는것!
test.page.html
<ion-list class="ctg-list">
<ion-radio-group allow-empty-selection = "true" name="radio-group" #raduiGroup>
<ion-item
*ngFor="let item of radio_list"
(ionSelect)="radioSelect($event)"
>
<ion-label>{{item.text}}</ion-label>
<ion-radio
slot="start"
name="{{item.name}}"
value="{{item.value}}"
checked="{{item.checked}}"
color="{{item.color}}"
disabled="{{item.disabled}}"
></ion-radio>
</ion-item>
</ion-radio-group>
</ion-list>
test.page.ts
@ViewChild('radioGroup') radioGroup: IonRadioGroup
selectedRadioItem:any;
radio_list = [
{
id: 'ctgRadio1',
name: 'radio_list',
value: 'ctg1',
text: '카테고리1',
disabled: false,
checked: false
}, {
id: 'ctgRadio2',
name: 'radio_list',
value: 'ctg2',
text: '카테고리2',
disabled: false,
checked: false
}, {
id: 'ctgRadio3',
name: 'radio_list',
value: 'ctg3',
text: '카테고리3',
disabled: false,
checked: false
}
];
참고사이트
https://www.freakyjolly.com/ionic-4-add-radio-lists-in-radio-group-example-and-tutorial/
Ionic 4 | Add Radio Lists in Radio Group Example and Tutorial | | Freaky Jolly
After the release of Ionic 4, the team has changed many of the UI component directives and properties. In this post, we will discuss Radio and Radio Group UI web components available in Ionic 4. In Ionic 4 we can add Radio form fields by simply adding dire
www.freakyjolly.com
728x90
반응형
'아이오닉' 카테고리의 다른 글
[하이브리드앱 ionic]시작해보기 11 - get함수 이용해 json 파일 읽어오기 (0) | 2019.07.11 |
---|---|
[하이브리드앱 ionic]시작해보기 10 - ion-input 값 가져오기 + 앵귤러 (2) | 2019.07.10 |
[하이브리드앱 ionic]시작해보기 8 - 모달창(ion-modal) 만들기 (0) | 2019.07.02 |
[하이브리드앱 ionic]시작해보기 7 - 페이지이동하면서 toast 창 보이기 (0) | 2019.07.02 |
[하이브리드앱 ionic]시작해보기 6 - 컴포넌트 css 적용하기 (0) | 2019.07.02 |
댓글