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

              
                <div class="container" ng-app="modalTest" ng-controller="dialogTestCtrl">
  <div class="row">
    <div class="col-md-12">
      <h1>Dialog Custom Service with Date Picker Demo</h1>
      <p>Testing whether another directive in a custom dialog works properly.  In this demo we'll use the Date Picker directive that comes with Angular-UI-Bootstrap.</p>
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">
      <button class="btn btn-primary" ng-click="launch()">Launch Custom Dialog</button>
    </div>
  </div>
  <div class="row">
    <div class="col-md-12">
      <br/>
      <p>Date Picked: <span class="text-info">{{data.dt | date:'fullDate' }}</span></p>
    </div>
  </div>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                angular.module('modalTest',['ui.bootstrap','dialogs.main'])

  .controller('dialogTestCtrl',function($scope,dialogs){
    //== Variables ==//
    $scope.data = {
      dt: new Date()
    };
    
    //== Methods ==//
    $scope.launch = function(){
      var dlg = dialogs.create('/dialogs/custom.html','customDialogCtrl',$scope.data);
      dlg.result.then(function(data){
        $scope.data = data;
      });
    }; // end launch
  }) // end dialogTest

  .controller('customDialogCtrl',function($log,$scope,$modalInstance,data){
    $scope.data = data;
    $scope.opened = false;
    
    //== Listeners ==//
    $scope.$watch('data.dt',function(val,old){
      $log.info('Date Changed: ' + val);
      $scope.opened = false;
    });
    
    //== Methods ==//
    $scope.setDate = function(){
      if(!angular.isDefined($scope.data.dt))
        $scope.data.dt = new Date(); // today
    };
    $scope.setDate();
    
    $scope.open = function($event){
      $event.preventDefault();
      $event.stopPropagation();
      $scope.opened = true;
    }; // end open
    
    $scope.done = function(){
      $modalInstance.close($scope.data);
    }; // end done
  }) // end customDialogCtrl

  .config(function(dialogsProvider){
    // this provider is only available in the 4.0.0+ versions of angular-dialog-service
    dialogsProvider.useBackdrop(true);
    dialogsProvider.useEscClose(true);
    dialogsProvider.useCopy(false);
    dialogsProvider.setSize('sm');
  }) // end config

  .run(function($templateCache){
    $templateCache.put('/dialogs/custom.html','<div class="modal-header"><h4 class="modal-title">Date Picker Test</h4></div><div class="modal-body"><p class="input-group"><input type="text" class="form-control" datepicker-popup="dd-MMMM-yyyy" ng-model="data.dt" datepicker-mode="year" is-open="opened" show-button-bar="false" /><span class="input-group-btn"><button class="btn btn-default" ng-click="open($event)"><span class="glyphicon glyphicon-calendar"></span></button></span></p></div><div class="modal-footer"><button class="btn btn-default" ng-click="done()">Done</button></div>');
  }); // end run
              
            
!
999px

Console