Enable Persistence

28 Jun 20171 minute to read

The value of DateRangePicker can be sustained even after form post back and page refreshing by enabling the enablePersistence API as shown in the below code example.

  • HTML
  • <div ng-controller="DaterangeCtrl">
         <input type="text" id="daterange" ej-daterangepicker e-width="width" e-enablePersistence="enable" />
    </div>
  • JAVASCRIPT
  • <script>
        angular.module('syncApp', ['ejangular'])
           .controller('DateRangeCtrl', function ($scope) {
              $scope.width = "600px";
              $scope.enable = true;
               });
    </script>

    Run the above code to get the below output.

    The DateRangePicker Model value will be stored in local storage / cookies of browser before page refreshes and reinitialized with the restored model after refresh