title: generate random id number within angular template just once
body: <p>I would like to know the way for generating random id in angular template once the page loads. The problem I am facing is that every second I get different ID in the two spans. I want it to be the same on both places and dont want it to change its value every second. Here is my simple template:</p>
  
  <pre><code>&lt;main class="has-header has-padding"&gt;
  &lt;div id = "command"&gt;-ID:&lt;span&gt;{{vm.getRandomId()}}&lt;/span&gt; -connect  -run&lt;/div&gt;
      &lt;hr&gt;
  &lt;div id = "command"&gt;-ID:{{vm.getRandomId()}}&lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>my controller:</p>
  
  <pre><code>'use strict';
  
  (function() {
      angular
          .module('myApp')
          .controller('myController.ctrl', myController);
  
      myController.$inject = ['$scope'];
  
      function screenSharingCtrl($scope) {
          angular.extend(this, {
              getRandomId:getRandomId
          });
  
          function getRandomId() {
              return Math.floor((Math.random()*6)+1);
          }
      }
  })();
  </code></pre>
  
  <p>Sorry if it is a duplicate question.
  Any help is appreciated!
  Thank you!</p>