Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

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

    <title>Non cached view using dynamic ng-repeat</title>



    <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
    <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
    <script src="https://code.angularjs.org/1.2.9/angular-resource.js"></script>

  </head>

  <body>

    <ion-nav-bar class="bar-positive">
      <ion-nav-back-button class="button-icon ion-arrow-left-c">
      </ion-nav-back-button>
    </ion-nav-bar>

    <ion-nav-view></ion-nav-view>
    <script id="templates/menu.html" type="text/ng-template">
      <ion-side-menus enable-menu-with-back-views="false">

        <ion-side-menu-content>
          <ion-nav-bar class="bar-stable">
            <ion-nav-back-button></ion-nav-back-button>
            <ion-nav-buttons side="left">
              <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
              </button>
            </ion-nav-buttons>
          </ion-nav-bar>
          <ion-nav-view name="menuContent"></ion-nav-view>
        </ion-side-menu-content>

        <ion-side-menu side="left">

          <ion-content scroll="false" class="sidebar-bg">

            <ion-list >

              <ion-item nav-clear menu-close class="item item-icon-left" href="#/app/browse">
                <i class="icon ion-gear-a"></i>Browse
              </ion-item>

            </ion-list>
          </ion-content>
        </ion-side-menu>
      </ion-side-menus>
    </script>
    <script id="templates/browse.html" type="text/ng-template">
      <ion-view view-title="Quedadas">
        <ion-content class="has-header">

          <ion-list>
            <ion-item ng-repeat="activeqdd in activeqdds" class="list card" style="padding-right: 0px;">
              <div class="item item-avatar"  ng-click="verqdd({{activeqdd.idquedada}})">
                <h2 class="royal">{{activeqdd.sport}}</h2>
                <h2><i class="icon ion-clock">&nbsp;&nbsp;</i>{{activeqdd.fecha}}</h2>
                <h3 class="positive">{{activeqdd.lugar}}</h3>

                <p class="subdued">Creado por {{activeqdd.name}}</p>
              </div>


            </ion-item>
          </ion-list>
        </ion-content>
      </ion-view>
    </script>

    <script id="templates/detail.html" type="text/ng-template">
      <ion-view view-title="Detail">
        <ion-content class="has-header">
          <div class="list card">
            <div class="item item-avatar">
              <h3 class="positive">{{qdd.sport}}</h3>
              <h2><i class="icon ion-clock">&nbsp;&nbsp;</i>{{qdd.fecha}} {{qdd.hora}}</h2>
              <h2 class="calm">{{qdd.lugar}}</h2>

            </div>

            <div class="item item-body">
              <div ng-if = "qdd.descripcion != 'none'">
                <h3>Descripcion</h3>
                <p>{{qdd.descripcion}}</p>
              </div>
              <p><a href="#" class="subdued">Creado por {{qdd.name}}</a></p>
              <div class="item item-divider">Asistentes</div>
              <ion-list ng-controller="UsersQddCtrl">
                <ion-item ng-repeat="userinvited in usersinvited" class="item item-avatar">



                  <h2>{{userinvited.name}}</h2>
                  <div ng-switch on={{userinvited.status}}>
                    <h4 ng-switch-when="5" class="royal">Creador {{userinvited.date_updated}}</h4>
                    <h4 ng-switch-when="0" class="energized">Pendiente, añadido el {{userinvited.date_updated}}</h4>
                    <h4 ng-switch-when="1" class="balanced">Confirmado el {{userinvited.date_updated}}</h4>
                    <h4 ng-switch-when="2" class="assertive">No asistirá {{userinvited.date_updated}}</h4>
                  </div>


                </ion-item>
              </ion-list>
              <p>
                <a href="#" class="subdued">Asistirán {{qdd.users_left}} / {{qdd.maxusers}}</a>
                <a href="#" class="subdued">5 Comentarios</a>
              </p>
            </div>

            <div class="item tabs tabs-secondary tabs-icon-left">
              <a ng-if = "qdd.iduser != loggeduser.id" class="tab-item" ng-controller = "UsersQddCtrl" ng-click="adduser({{qdd}})">
                <i class="calm icon ion-thumbsup"></i>
                ¡Me apunto!
              </a>
              <a class="tab-item" href="#">
                <i class="calm icon ion-chatbox"></i>
                Comentar
              </a>
              <a class="tab-item" ng-click="shareAnywhere()">
                <i class="calm icon ion-share"></i>
                Compartir
              </a>
            </div>

          </div>
        </ion-content>

      </ion-view>

    </script>



  </body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                angular.module('ionicApp', ['ionic','ngResource'])

.config(function($stateProvider, $urlRouterProvider) {

  $stateProvider

  .state('app', {
    url: '/app',
    abstract: true,
    templateUrl: 'templates/menu.html'
  })
  .state('app.browse', {
    url: '/browse',
    cache : true,
    views: {
      'menuContent': {
        templateUrl: 'templates/browse.html',
        controller: 'BrowseCtrl'
      }
    }
  })
  .state('app.detail', {
    url: '/detail/:id',
    views: {
      'menuContent': {
        templateUrl: 'templates/detail.html',
        controller: 'QddCtrl'
      }
    }
  });


  $urlRouterProvider.otherwise('/app/browse');

})



.controller('BrowseCtrl', function($ionicLoading,$location,$scope,$filter, $state, myService) {


  // update view information
  $scope.$on( "$ionicView.enter", function( scopes, states ) {
    $scope.init();
  });


  // called when item is clicked, we pass the id of the clicked
  // element in as the stateParam so the detail page can get the 
  // selected item.
  $scope.verqdd = function($activeqdd){
    console.log("$scope.verqdd " + $activeqdd);
    $state.go('app.detail', {
      id: $activeqdd
    });
  }

  //
  $scope.init = function(){
    $ionicLoading.show({
      template: 'Loading...'
    });
    $scope.getActiveQdd().then(function(res){
      //Success
      $scope.activeqdds = res.result;
      $ionicLoading.hide();

    }, function(status){
      //Err
      $scope.pageError = status;
    })
  }

  //
  $scope.getActiveQdd = function(){

    var $iduser = 1;
    var $fecha_actual = $filter('date')(new Date(), 'yyyy-MM-dd');
    var $hora_actual = $filter('date')(new Date(), 'HH:mm');
    var $hora = $hora_actual.replace(':', '-');

    return myService.query({
      iduser:$iduser, 
      fecha_actual : $fecha_actual, 
      hora:$hora
    });

  }

  $scope.init();
})

.controller('QddCtrl', function($scope, myService, $stateParams) {
  myService.get($stateParams.id).then(function(_data){
    $scope.qdd = _data.result[0];
    
      console.log('Players to Qdd: ', $scope.qdd);
    
  }, function(_error){
    alert("error " + _error);
  })

})

.controller('UsersQddCtrl', function($scope, $http, $q,myService) {

  $scope.init = function(){
    $scope.getUsersQdd()
    .then(function(res){
      //Success
      console.log('UsersQddCtrl: ', res);
      $scope.usersinvited = res.result;



    }, function(status){
      //Err
      $scope.pageError = status;
    })
  }
  $scope.getUsersQdd = function(){
    var defer = $q.defer();
    var $qddsel = myService.get();
    console.log('myserviceqdd: ', $qddsel);
    $http.jsonp('http://quedadas.magentadesigncorporation.com/quedadas/getUsersQdd/idquedada/' + $qddsel.idquedada + '/format/json?callback=JSON_CALLBACK')
    .success(function(res){
      defer.resolve(res)
    })
    .error(function(status, err){
      defer.reject(status)
    })

    return defer.promise;

  }

  //$scope.init();


}) 
.factory('myService', function($resource) {
  var savedData = {}
  function set(data) {
    savedData = data;
  }
  //
  //
  function _get(_id) {
    console.log("_get(_id)  " + _id);

    var baseUrl = 'http://quedadas.magentadesigncorporation.com/quedadas/getUsersQdd/idquedada/:id/format/json';
    var itemResource = $resource(baseUrl,  { 
      id: _id ,
      callback: "JSON_CALLBACK"
    },{
      get : { 
        method :"JSONP"
      }
    });

    var item = itemResource.get();
    item.$promise.then(function (data) {
      // do something with the data
      console.log(data);
      return data;
    }, function(_error){
      console.log(_error)
    });

    return item.$promise;  
  }

  /**
  */
  function _query(_options) {
    var baseUrl = 'http://quedadas.magentadesigncorporation.com/quedadas/getActiveQdd/iduser/' + ':id/fecha_actual/:fecha/hora/:hora/format/json';
    var productsResource = $resource(baseUrl,  { 
      id: _options.iduser ,
      fecha: _options.fecha_actual,
      hora: _options.hora,
      callback: "JSON_CALLBACK"
    },{
      query : { 
        method :"JSONP", 
        isArray : false
      }

    });


    var products = productsResource.query();
    products.$promise.then(function (data) {
      // do something with the data
      console.log(data);
      return data;
    }, function(_error){
      console.log(_error)
    });

    return products.$promise;    
  }

  return {
    set: set,
    get: _get,
    query : _query
  }

});
              
            
!
999px

Console