title: AngularJS directive create empty array in scope.
body: <p>I have created one directive and use scope variables in this way: </p>
  
  <pre><code>&lt;div data-create-instants-since-beginning data-daysnum="daysnum" data-tostore="tostore"&gt;
  </code></pre>
  
  <p>I want when tostore is undefined to set it to empty array but unfortunately this not working. </p>
  
  <pre><code>.directive("createInstantsSinceBeginning", function () {
          return {
              scope: {
                  daysnum: "=",
                  tostore: "="
              },
              link: function ($scope, element) {
                  if (typeof $scope.tostore == 'undefined') {
                      $scope.$apply(function () {
                          $scope.tostore = [];
                      });
                  }
      // other code .. 
  </code></pre>
  
  <p>How I can solve the problem? </p>
  
  <p>Best regards. </p>