Mark Lalich

Mark Lalich

  • NA
  • 14
  • 1k

Site not loading record

Jan 3 2019 4:28 PM
I have an application that when I debug, I can see the data is being set properly, but when the page loads, nothing is populated in the textbox.
 
Here is the list code and what happens when a row is clicked.
  1. <tbody>  
  2.         <tr data-ng-repeat="organization in organizations | filter:search" data-ng-click="navToEdit($index)">  
  3.             <td>{{organization.Id}}</td>  
  4.             <td>{{organization.Title}}</td>  
  5.         </tr>  
  6. </tbody>  
 Here's my controller. 
  1. app.controller("organizationsCtrl", ["$scope""$location""$routeParams""spService",    
  2.     function ($scope, $location, $routeParams, spService) {    
  3.         var listTitle = "Organizations";    
  4.     
  5.         $scope.editing = false;    
  6.     
  7.         //example populating Organizations    
  8.         spService.getRecords(listTitle, "?$select=ID,Title").then(function (result) {    
  9.             $scope.organizations = result;    
  10.         });    
  11.     
  12.         $scope.navToAdd = function() {    
  13.             $location.path("/organizations/add");    
  14.         }    
  15.     
  16.         $scope.navToEdit = function(index) {    
  17.             $scope.organization = $scope.organizations[index];    
  18.             $location.path("/organizations/" + index);    
  19.             debugger;    
  20.             //$scope.getRecord(index);    
  21.         }    
  22.     }    
  23. ]);   
 The same controller is used for "/organizations", "/organizations/add" and "/organizations/:index".
 
Here is the HTML routing takes the user to.
 
  1. <div class="form-group">  
  2.     <label for="txtTitle">Title:</label>  
  3.     <input type="text" type="text" id="txtTitle" class="form-control" data-ng-model="organization.Title" />  
  4. </div>  
  5. <div class="form-group">  
  6.     <button data-ng-click="save()" class="btn btn-primary">Save</button>  
  7.     <button data-ng-click="delete()" class="btn btn-primary">Delete</button>  
  8.     <button data-ng-click="cancel()" class="btn btn-primary">Cancel</button>  
  9. </div>  
 
 
When the debugger kicks off, I can see $scope.organization is populated correctly, but when the page fully loads the textbox never populates.
 
Any help is appreciated! 

Answers (3)