Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. services/items.js:
  2.  
  3. angular.module('App').factory('items', function() {
  4. var items = [
  5. { id: 0, name: 'Scruff McGruff' },
  6. { id: 1, name: 'G.I. Joe' },
  7. { id: 2, name: 'Miss Frizzle' },
  8. { id: 3, name: 'Ash Ketchum' }
  9. ];
  10.  
  11. return items;
  12. });
  13.  
  14. --------------------------------------------------------------------------
  15. controllers/items.js:
  16.  
  17. 'use strict';
  18.  
  19. angular.module('App').controller('ItemsController', function($scope, items) {
  20. $scope.items = items.query();
  21. })
  22.  
  23. --------------------------------------------------------------------------
  24. tab-items.html:
  25. <ion-view title="Items">
  26. <ion-content>
  27. <ion-list>
  28. <ion-item ng-repeat="item in items" type="item-text-wrap" href="#/tab/item/{{item.id}}">{{item.name}} - {{item.description}}</ion-item>
  29. </ion-list>
  30. </ion-content>
  31. </ion-view>
  32.  
  33. --------------------------------------------------------------------------
  34. app.js:
  35.  
  36. .state('tab.items', {
  37. url: '/items',
  38. views: {
  39. 'tab-items': {
  40. templateUrl: 'templates/tab-items.html',
  41. controller: 'ItemsController'
  42. }
  43. }
  44. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement