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. 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

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>Ionic Modal</title>

    <link href="//code.ionicframework.com/1.0.0-beta.12/css/ionic.css" rel="stylesheet">
    <script src="//code.ionicframework.com/1.0.0-beta.12/js/ionic.bundle.js"></script>
  </head>
  <body ng-controller="AppCtrl">
    
    <ion-header-bar class="bar-positive">
      <h1 class="title">Contacts</h1>
      <div class="buttons">
        <button class="button button-icon ion-compose" ng-click="modal.show()">
        </button>
      </div>
    </ion-header-bar>
    <ion-content>
      <ion-list>
        <ion-item ng-repeat="item in items" ng-click="editItem(item)">
          {{item.name}} 
        </ion-item>
      </ion-list>
    </ion-content>
    
    <script id="templates/modal.html" type="text/ng-template">
      <ion-modal-view class="product edit create" >
      <form name="itemEdit" novalidate ng-submit="submitForm(itemEdit.$valid)">
        <ion-header-bar class="bar-positive fix-buttons">
          <button class="button" ng-click="cancel()">Cancel</button>
           <h1 class="title">{{ pageTitle }}</h1>
          <button class="button" ng-click="saveItem(itemEdit.$valid)"  animate-on-loading data-text="Post">Post</button>
        </ion-header-bar>
        <ion-content has-bouncing="true">
    <div class="row">
      <div class="col">
        <label class="item item-input large">
        <input type="text" placeholder="{{item.type }} Name*" ng-model="item.name" required name="title">
        </label> 
                  
      </div>
    </div>
    <div class="row" ng-show="(itemEdit.title.$dirty && itemEdit.title.$error.required) || (data.itemSubmitted && itemEdit.title.$error.required)">
      <div class="col">
        <div class="error clearfix" >Title is required.</div> 
      </div>
    </div>
    <div class="row">
      <div class="col">
        <img src="{{item.image}}" /> 
      </div>
    </div>
    <div class="row">
      <div class="col">
        Some more spacer text to push the text description down. <br/><br/><br/><br/>
      </div>
    </div>
    
    <div class="row">
      <div class="col"> 
        <label class="item item-input text">
          <textarea placeholder="{{item.type }} Description*" rows="1" ng-model="item.description" ng-Required="true" name="description"></textarea>
        </label>
        
      </div>
    </div>
    <div class="row">
      <div class="col">
        <div class="error clearfix" ng-show="(itemEdit.description.$dirty && itemEdit.description.$error.required) || (data.itemSubmitted && itemEdit.description.$error.required)">Description is required.</div>
      </div>
    </div>   
    
</ion-content>
      </form>
    </ion-modal-view>
    </script>
    
  </body>
</html>

              
            
!

CSS

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

JS

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

.controller('AppCtrl', function($scope, $ionicModal) {
  $scope.data = {
    itemSubmitted:false,
  }
  $scope.items = [
    { name: 'Cat - Click to edit me', description:'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin dapibus sodales dictum. Integer varius accumsan urna vitae congue. Aliquam lectus urna, dictum id magna vitae, fermentum tempor neque. Vestibulum suscipit, mi eget porta iaculis, eros orci iaculis enim, ac consectetur est diam eu nibh. Sed tincidunt rutrum maximus. Sed feugiat risus urna, et fringilla nulla aliquet et.', image:'http://placekitten.com/350/301' },
    { name: 'Refrigerator', description: 'Like new' , image:'http://placekitten.com/350/302'},
    { name: 'Bowl of Cherries', description:'Rainiers' , image:'http://placekitten.com/350/303'},
  ];

  $ionicModal.fromTemplateUrl('templates/modal.html', {
    scope: $scope
  }).then(function(modal) {
    $scope.modal = modal;
  });
  
  $scope.createContact = function(u) {        
    $scope.contacts.push({ name: u.firstName + ' ' + u.lastName });
    $scope.modal.hide();
  };
    
  $scope.item = {};
    
  $scope.editItem = function(item) {
    $scope.modal.show();
    $scope.item = item;
    }  
  $scope.saveItem = function (valid) {
    if(valid){
    console.log($scope.item);
    $scope.items.push($scope.item);
    console.log($scope.items);
      $scope.modal.hide();
    } else {
      $scope.data.itemSubmitted = true;
    }
  };
    
 $scope.cancel = function(){
   $scope.modal.hide();
 }

})
  .directive('textarea', function() {
  return {
    restrict: 'E',
    link: function(scope, element, attr){
        var update = function(){
            element.css("height", "auto");
            var height = element[0].scrollHeight; 
            element.css("height", element[0].scrollHeight + "px");
        };
        scope.$watch(attr.ngModel, function(){
            update();
        });
    }
  };
});
              
            
!
999px

Console