Hello:

I am pretty new to angular js.  Here is the issue:    I display a model 
panel with 2 drop down boxes.  Box 1 is a list of departments and Box 2 is 
list of titles for that department.  When user changes a value in Box 1 I 
do a $scope.watch on that value and am able to retrieve the correct list of 
titles for department however the new list of values will not populate into 
drop box 2 inside the modal panel.  I have included some snippets of code 
for your review.

  html code:
                                       <tr>
                                          <td align="right" 
style="padding-bottom:8px;">Department:&nbsp;&nbsp;</td>
                                          <td style="padding-bottom:8px;">
                                              <select name="deptName"    
ng-model="department.displayKey" ng-options="d.displayKey as d.dptDesc for 
d in departments">
                                                <option value 
="">Select</option>
                                            </select>&nbsp;&nbsp;<span 
ng-show="deptAsterisk == true" style="font-weight:bold; 
color:red;">**</span> 
                                          </td>
                                      </tr>

                                      <tr>
                                          <td align="right" 
style="padding-bottom:8px;">Badge Title:&nbsp;&nbsp;</td>
                                          <td style="padding-bottom:8px;">
                                                <select name="jobTitle" 
ng-model="title.displayKey" ng-options="t.displayKey as t.displayDesc for t 
in titles">
                                                <option value 
="">Select</option>
                                            </select>&nbsp;&nbsp;<span 
ng-show="titleAsterisk == true" style="font-weight:bold; 
color:red;">**</span> 
                                          </td>





Parent scope:

 IdbadgeManager.findTitlesForDepartment($scope.department.dptKey, 
function(titles)
                                 {
                                    $scope.titles = titles;
    
                                     (more code here)
      //the call to the modal panel

var    modalInstance = $modal.open({
                                                templateUrl: 
'/uihchr/ermaapps/idbadge/editIdbadgeModalPanel.html?unique=' + unique,
                                                scope: $scope,
                                                controller: 
editIdbadgeModalPanelCtrl,
                                                resolve: { titles : 
function() {return titles;}



  
  controller for modal panel

$scope.$watch('department.displayKey', function(newValue, oldValue)        
    {
        
        //as the dept changes we need to update to the correct title list
        if(newValue != oldValue)
        {
            IdbadgeManager.findTitlesForDepartment(newValue, function(data)
            {
               
                $scope.titles = [];
                $scope.titles = data;
               
              
                    

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to