title: Anguraljs Custom directive does not work after changing the object declaration
body: <p>I have added custom <code>validation-summary</code> directive in my project <a href="https://github.com/sgudjonsson/angular-validation-summary/blob/master/validationSummary.js" rel="nofollow noreferrer">from this git-hub link.</a> It works fine.</p>
  <pre><code>angular.module(&quot;ValidationSummaryModule&quot;).directive(&quot;validationSummary&quot;, function() {
      return {
          restrict: &quot;A&quot;,
          require: &quot;^form&quot;,
          template: &quot;&lt;ul&gt;&lt;li ng-repeat='(expression,message) in validationMessages'&gt;{{message}}&lt;/li&gt;&lt;/ul&gt;&quot;,
          link: function(scope, element, attributes, controller) {
  
              scope.validationMessages = {};
  
              // Hooks up a watch using [ng-show] expression
              controller.watchValidation = function(expression, message) {
  
                  // watch the return value from the scope.$eval(expression)
                  scope.$watch(function() { return scope.$eval(expression); }, function(isVisible) {
  
                      // check if the validation message exists
                      var containsMessage = scope.validationMessages.hasOwnProperty(expression);
  
                      // if the validation message doesn't exist and it should be visible, add it to the list
                      if(!containsMessage &amp;&amp; isVisible)
                          scope.validationMessages[expression] = message;
  
                      // if the validation message does exist and it shouldn't be visible, delete it
                      if(containsMessage &amp;&amp; !isVisible)
                          delete scope.validationMessages[expression];
                  });
  
              };
  
          }
      };
  }); 
  </code></pre>
  <p>But if I change the object declaration from <code>scope.validationMessages = {};</code> to <code>scope.validationMessages = [];</code> It does not work. I debugged the code in browser but could not find out the reason.</p>
  <p>I need to change the declaration because <code>scope.validationMessages = {};</code> give me an unordered list. I need ordered list.</p>