title: scope access in angular js
body: <p>I am having trouble accessing a variable using angularjs and ionic. I have a page where I am listing an amount of items: </p>
  
  <pre><code>&lt;ion-item ng-repeat="item in items" 
                item="item"
                href=""
                style="max-height:70px; padding: 0px 0px 0px 0px;"
                &gt;             
  
               &lt;div class="containerText" style="position:absolute; float:left; margin-left:60px"&gt;
                  &lt;div class="" style="font-size:11px"&gt;               
                      {{item.datea}}
                  &lt;/div&gt;
                  &lt;div class="" style="margin-top:4px; font-weight:bold; text-align:right"&gt;
                      {{item.value}}                  
                  &lt;/div&gt;
              &lt;/div&gt;
  (...)
  </code></pre>
  
  <p>And I want to load the item.value when I press the "download" button that each item row has next to the delete icon: </p>
  
  <p><a href="https://i.stack.imgur.com/Xn71q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Xn71q.png" alt="screenshot of the app"></a></p>
  
  <p>I am converting all the numbers to strings in the input field to make it easier to control the changes (like adding a decimal point or deleting the last value of that string). </p>
  
  <p>My controller.js has these functions: </p>
  
  <pre><code>$scope.searchText = "0";
  </code></pre>
  
  <p>(...) </p>
  
  <pre><code>/****************** KEYBOARD FUNCTIONS ************************/    
  //Adds a number in the field text above the keyboard
  $scope.addNumber = function(num) {
  
   //limiting the amount of numbers in the display 
   if (this.searchText.length &lt; 20)
       if (this.searchText == "0")
           if (num != '.')
               this.searchText=num;
           else
               this.searchText = (this.searchText) + num;
       else
           if (num!='.')
               this.searchText = (this.searchText) + num;
           else if (this.searchText.indexOf('.') == -1)
               this.searchText = (this.searchText) + num;             
  }
  
  //Used to delete the number in the screen and set it to 0  
  //AKA RESET
  $scope.deleteNumbers = function(){ 
    this.searchText= "0"; 
    console.log("ERASING!");
  }
  
  //Used to delete the last entered digit/symbol
  $scope.deleteLast = function(){
       this.searchText = this.searchText.slice(0, -1);
       if (this.searchText.length==0)
       {
          this.searchText = "0";
       }  
  }  
  
  //used to load the values of an element of the list to the display
  $scope.loadItem = function(valueToAdd){
  
      console.log("Load values ");
  
      $scope.deleteNumbers();
      $tempVal = valueToAdd.toString();   
      $scope.addNumber($tempVal);
  
      console.log("value in this.searchText " + this.searchText);
      console.log("value in scope.searchText " + $scope.searchText);
      console.log(isNaN($tempVal));
  }
  </code></pre>
  
  <p>And it loads nicely the first execution (only if I have not pressed the coded keyboard before), but after touching my created keyboard, the "load number" function stops working. </p>
  
  <p>My console.log looks like this when I load the page and I press one of thos download buttons: </p>
  
  <pre><code>controllers.js:185 Load values 
  controllers.js:77 ERASING!
  controllers.js:212 value in this.searchText 14458.553
  controllers.js:213 value in scope.searchText 14458.553
  controllers.js:214 false
  </code></pre>
  
  <p>As you can see, it says that it is a numeric value that has been loaded into the field, but it let's me add additional numbers or delete the chars of the input string without problem, but if I want to load another value (or even the same previously loaded) it seems that the scope gets messed up as I get this output. </p>
  
  <pre><code>controllers.js:185 Load values 
  controllers.js:77 ERASING!
  controllers.js:212 value in this.searchText 14458.55
  controllers.js:213 value in scope.searchText 15429.477
  controllers.js:214 false
  </code></pre>
  
  <p>I have tried modifying at the same time this.searchText and scope.searchText but without result. What can I do to fix this? </p>