title: Multiple Directive Resource Contention Error in Angular
body: <p>I have such definition of my custom directive: </p>
  
  <pre><code>crmModule.directive("some", [function() {
  return {
      restrict: "E",
      replace: true,
      scope: {
          itemModel: "=model"
      },
      templateUrl: "/Static/CRMpages/user-details-templates/preview-template.html",
      link: function (scope, element, attrs) {
          if (scope.itemModel.dueDateEnabled) {
              scope.itemModel.date = scope.itemModel.dueDate.getDate();
              scope.itemModel.month = scope.itemModel.dueDate.toLocaleDateString("en", { month: "short" }).toUpperCase();
              scope.itemModel.time = scope.itemModel.dueDate.toLocaleTimeString("en", { hour: "numeric", minute: "numeric" });
          }
          scope.$watch('itemModel.dueDate', function() {
              scope.itemModel.date = scope.itemModel.dueDate.getDate();
              scope.itemModel.month = scope.itemModel.dueDate.toLocaleDateString("en", { month: "short" }).toUpperCase();
              scope.itemModel.time = scope.itemModel.dueDate.toLocaleTimeString("en", { hour: "numeric", minute: "numeric" });
          });
      }
  
  }}])
  </code></pre>
  
  <p>And in my HTML page I use it in following way: </p>
  
  <pre><code>&lt;some model="actionModel"/&gt;
  </code></pre>
  
  <p>In the same time I have main page, where I have button, when I click on this button I change route (I use <code>ui-router</code>) to <code>clients.action.edit</code> and load template <code>edit.html</code>:</p>
  
  <pre><code>&lt;div class="action-plan-edit"&gt;
  &lt;div class="checkboxes col-sm-4"&gt;
      &lt;div class="due-date-section"&gt;
          &lt;div class="labels"&gt;
              &lt;input  id="dueDateEnabled" type="checkbox" ng-model="actionModel.dueDateEnabled"&gt;
              &lt;span&gt;Set due date&lt;/span&gt;
          &lt;/div&gt;
  
          &lt;div class="dueDate-selector" slide open="actionModel.dueDateEnabled"&gt;
              &lt;div date-picker="actionModel.dueDate" nd-model="actionModel.dueDate" view="month" min-view="hours" max-view="month"&gt;&lt;/div&gt;
              &lt;div class="selected-time"&gt;
                  &lt;span class="date"&gt;{{actionModel.dueDate|itemDate}}&lt;/span&gt;
                  &lt;span class="time"&gt;{{actionModel.dueDate|itemTime}}&lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
      &lt;div class="booking-section"&gt;
          &lt;div class="labels"&gt;
              &lt;input  id="bookingAttached" type="checkbox" ng-model="actionModel.bookingEnabled"&gt;
              &lt;span&gt;Attach booking&lt;/span&gt;
          &lt;/div&gt;
  
          &lt;div class="booking-attachment-area" slide open="bookingEnabled"&gt;
              &lt;select&gt;&lt;/select&gt;
              &lt;select&gt;&lt;/select&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="sms-section"&gt;
          &lt;div class="labels"&gt;
              &lt;input id="smsEnabled" type="checkbox" ng-model="actionModel.smsEnabled" &gt;
              &lt;span&gt;Send sms to client&lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  
  &lt;/div&gt;
  &lt;div class="result-preview col-sm-6"&gt;
      &lt;div class="input-section"&gt;
          &lt;textarea class="crm-text-area" ng-model="actionModel.description" placeholder="Action description.."&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div class="bordered-block"&gt;
           &lt;p class="preview-header"&gt;Live preview of action item&lt;/p&gt;
          &lt;some model="actionModel"/&gt;
      &lt;/div&gt;
  
      &lt;div class="save-button-section"&gt;
          &lt;button class="save-button" ng-click="saveItem()" ng-disabled="!itemValid"&gt;Save&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>As you see a I use directive <code>some</code> in this page. Al needed files included, but I always got such error.</p>
  
  <blockquote>
    <p>Multiple directives [some, some] asking for template on: </p>
  </blockquote>
  
  <p>Help me please to resolve such issue.</p>
  
  <p><strong>UPDATE</strong>: I found that link function of the directive called twice. Can it be an issue with <code>ui-router</code>?</p>