Difference between ion-item and div class="item" ionic

1

I would like to know what difference there is between using one versus the other, because you see it in the style documentation ( css ), and the other one in < strong> javascript .

  • What advantages one has over the other when creating the templates
  • <!--Opcion 1-->
    
    <ul class="list">
        <li class="item">
          ...
        </li>
    </ul>
    
    
    <!--Opcion 2-->
    
    <ion-list>
      <ion-item ng-repeat="item in items">
        Hello, {{item}}!
      </ion-item>
    </ion-list>
  • Advantages between creating templates using index.html or type="text / ng-template"
  • <!-- Opcion 1 - index.html -->
    
    <div class="list">
      <p></p>
      <h1></h1>
    </div>
    
    
    <!-- Opcion 2 -->
    
    <script type="text/ng-template" id="todos.html">
        <!-- Contenido plantilla -->     
    </script>
        
    asked by Pedro Miguel Pimienta Morales 26.02.2016 в 16:02
    source

    2 answers

    4

    > > 1.What advantages do you have over each other when creating templates?

    The fundamental difference is that by using <ion-list> and <ion-item> you use the directive so you have more functionality and access to more options on the api it is implemented.

    It is advisable to use the directives.

    In the ionic forums the same topic was raised

    Ion vs div directives

    Difference between and <ul class=“list”> ?

    > > 2.Advantages between creating templates using index.html or type="text / ng-template"

    I do not see that there is an advantage in one method or another, maybe it depends on how you define the template.

    If you use a index.html you can only define one template per file, instead using the type="text/ng-template you can define several in the same file .js

        
    answered by 26.02.2016 / 16:18
    source
    0

    According to the official documentation in the following league:

    Spanish:

      

    However, using the ionList and ionItem directives makes it easier to support several interaction modes, such as drag to edit (swipe), drag and reorder (drag), and remove elements.

    English:

      

    However, using the ionList and ionItem directives make it easy to support various interaction modes such as swipe to edit, drag to reorder, and removing items.

    Therefore it depends on what you want to create, but if your list depends on some interactions already mentioned in the translated quote, I recommend using the Ionic directives.

        
    answered by 26.02.2016 в 20:17