css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <html ng-app="ionicApp">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Ionic Multiple ng-repeat</title>

    <link href="//code.ionicframework.com/1.0.0-beta.13/css/ionic.css" rel="stylesheet">
    <script src="//code.ionicframework.com/1.0.0-beta.13/js/ionic.bundle.js">
    </script>
  </head>
  <body ng-controller="MyCtrl">

    <ion-header-bar class="bar-positive">
      <div class="buttons">
        
        <h1 class="title">Ionic Delete/Option Buttons</h1>
        
      </div>
    </ion-header-bar>

    <ion-content>
    <div>
    <ion-list ng-repeat="chat in chats track by $index" ng-if="$index % 3 === 0">
      <ion-item class="item-remove-animate item-avatar item-icon-right"  type="item-text-wrap" href="#/tab/chats/{{chats[$index].id}}" ng-if="$index < chats.length">
          
          <h2>{{chats[$index].name}}</h2>
          <p>{{chats[$index].lastText}}</p>
          <i class="icon ion-chevron-right icon-accessory"></i>

          <ion-option-button class="button-assertive" ng-click="remove(chats[$index])">
            Delete
          </ion-option-button>
      </ion-item>
      <ion-item class="item-remove-animate item-avatar item-icon-right"  type="item-text-wrap" href="#/tab/chats/{{chats[$index+1].id}}" ng-if="$index+1 < chats.length">
          
          <h2>{{chats[$index+1].name}}</h2>
          <p>{{chats[$index+1].lastText}}</p>
          <i class="icon ion-chevron-right icon-accessory"></i>

          <ion-option-button class="button-assertive" ng-click="remove(chats[$index+1])">
            Delete
          </ion-option-button>
      </ion-item>
      <ion-item class="item-remove-animate item-avatar item-icon-right"  type="item-text-wrap" href="#/tab/chats/{{chats[$index+2].id}}" ng-if="$index+2 < chats.length">
          
          <h2>{{chats[$index+2].name}}</h2>
          <p>{{chats[$index+2].lastText}}</p>
          <i class="icon ion-chevron-right icon-accessory"></i>

          <ion-option-button class="button-assertive" ng-click="remove(chats[$index+2])">
            Delete
          </ion-option-button>
      </ion-item>
      <ion-item  ng-repeat ="ad in ads" class="item-remove-animate" ng-if="$index % ads.length === 0">
        <p>{{ad.text}}</p>
      </ion-item>
    </ion-list>
  </div>
  </ion-content>

  </body>
</html>
            
          
!
            
              body {
  cursor: url('https://ionicframework.com/img/finger.png'), auto;
}

.item-content{
  color: white !important;
}

.item-content:before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  opacity: 0 !important;
  background: rgba(0,0,0,0.5) !important;
  -moz-transition: opacity 0.25s !important;
  -webkit-transition: opacity 0.25s !important;
  transition: opacity 0.25s !important;
  z-index: -1;
}


.item-content.activated:before {
  opacity: 1 !important;
}

            
          
!
            
              angular.module('ionicApp', ['ionic'])
.factory('AdFactory', function(){

    var ads = [
                {id:0, title: 'Ad 0', category:'electrical', text:'Ad 1 will be here'},
                {id:1, title: 'Ad 1', category:'electrical', text:'Ad 2 will be here'},
                {id:2, title: 'Ad 2', category:'electrical', text:'Ad 3 will be here'},
                {id:3, title: 'Ad 3', category:'electrical', text:'Ad 4 will be here'},
                {id:4, title: 'Ad 4', category:'electrical', text:'Ad 5 will be here'},
                {id:5, title: 'Ad 5', category:'electrical', text:'Ad 6 will be here'},
                {id:6, title: 'Ad 6', category:'electrical', text:'Ad 7 will be here'},
                {id:7, title: 'Ad 7', category:'electrical', text:'Ad 8 will be here'},
                {id:8, title: 'Ad 8', category:'electrical', text:'Ad 9 will be here'},
                {id:9, title: 'Ad 9', category:'electrical', text:'Ad 10 will be here'},

            ];


    return ads;
})
.factory('Chats', function() {
  // Might use a resource here that returns a JSON array

  // Some fake testing data
  var chats = [{
    id: 0,
    name: 'Ben Sparrow',
    lastText: 'You on your way?',
    face: 'img/ben.png'
  }, {
    id: 1,
    name: 'Max Lynx',
    lastText: 'Hey, it\'s me',
    face: 'img/max.png'
  }, {
    id: 2,
    name: 'Adam Bradleyson',
    lastText: 'I should buy a boat',
    face: 'img/adam.jpg'
  }, {
    id: 3,
    name: 'Perry Governor',
    lastText: 'Look at my mukluks!',
    face: 'img/perry.png'
  }, {
    id: 4,
    name: 'Mike Harrington',
    lastText: 'This is wicked good ice cream.',
    face: 'img/mike.png'
  },
  {
    id: 5,
    name: 'Ben Sparrow1',
    lastText: 'You on your way?',
    face: 'img/ben.png'
  }, {
    id: 6,
    name: 'Max Lynx1',
    lastText: 'Hey, it\'s me',
    face: 'img/max.png'
  }, {
    id: 7,
    name: 'Adam Bradleyson1',
    lastText: 'I should buy a boat',
    face: 'img/adam.jpg'
  }, {
    id: 8,
    name: 'Perry Governor1',
    lastText: 'Look at my mukluks!',
    face: 'img/perry.png'
  }, {
    id: 9,
    name: 'Mike Harrington1',
    lastText: 'This is wicked good ice cream.',
    face: 'img/mike.png'
  },
  {
    id: 10,
    name: 'Ben Sparrow2',
    lastText: 'You on your way?',
    face: 'img/ben.png'
  }, {
    id: 11,
    name: 'Max Lynx2',
    lastText: 'Hey, it\'s me',
    face: 'img/max.png'
  }, {
    id: 12,
    name: 'Adam Bradleyson2',
    lastText: 'I should buy a boat',
    face: 'img/adam.jpg'
  }, {
    id: 13,
    name: 'Perry Governor2',
    lastText: 'Look at my mukluks!',
    face: 'img/perry.png'
  }, {
    id: 14,
    name: 'Mike Harrington2',
    lastText: 'This is wicked good ice cream.',
    face: 'img/mike.png'
  },
  {
    id: 15,
    name: 'Ben Sparrow3',
    lastText: 'You on your way?',
    face: 'img/ben.png'
  }, {
    id: 16,
    name: 'Max Lynx3',
    lastText: 'Hey, it\'s me',
    face: 'img/max.png'
  }, {
    id: 17,
    name: 'Adam Bradleyson3',
    lastText: 'I should buy a boat',
    face: 'img/adam.jpg'
  }, {
    id: 18,
    name: 'Perry Governor3',
    lastText: 'Look at my mukluks!',
    face: 'img/perry.png'
  }, {
    id: 19,
    name: 'Mike Harrington3',
    lastText: 'This is wicked good ice cream.',
    face: 'img/mike.png'
  }];

  return {
    all: function() {
      return chats;
    },
    remove: function(chat) {
      chats.splice(chats.indexOf(chat), 1);
    },
    get: function(chatId) {
      for (var i = 0; i < chats.length; i++) {
        if (chats[i].id === parseInt(chatId)) {
          return chats[i];
        }
      }
      return null;
    }
  };
})
.controller('MyCtrl', function($scope, Chats, AdFactory) {

 $scope.ads = AdFactory;
  $scope.chats = Chats.all();

});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console