kramer65 kramer65 - 1 year ago 71
HTML Question

Difference between <ion-list> and <div class="list"> in Ionic framework?

I'm building an app with the Ionic Framework. I started off with the standard ionic tabs starter project as described in the getting started guide. In a list I now want to put a divider as described here:

<div class="list">
<div class="item item-divider"> <!-- this creates the divider -->
Candy Bars
<a class="item" href="#">

to my surprise however, the pre generated code in my list looks like this:

<ion-item class="item-toggle">
Enable Friends
<label class="toggle">
<input type="checkbox" ng-model="settings.enableFriends">
<div class="track">
<div class="handle"></div>

So this made me wonder: what is (if any) the difference between
<div class="list">

In line with the pre-generated code I tried to create a divider using
, but that didn't work. So I resided to
<div class="item item-divider">
which works fine. I just wonder what the difference is between these "magic"
tags and the traditional
<div class="xxx">

Any information is welcome!

Answer Source

I believe that using the standard HTML formatting such as <div class="list">will give you all the CSS styling that you are looking for, but in some cases using the Ionic directives will provide additional functionality that may be missing with pure HTML/CSS. Check out this link to the Ionic forums for more info on the subject.