It's been forever since I looked at angular, so bear with me.  I'm 
currently playing with two modules:  angular-table an ng-quick-repeat. 
 angular-table currently uses ng-repeat.  I'm trying to replace it with 
ng-quick-repeat to play around.  Why can't my demoController see the 
modifications that angular-table made to the 
QuickList.value('quickRepeatList')?  Doing a console.log in the 
quickNgRepeat directive shows that the value has changed.  The 
demoController always sees {}, though.

QuickTable has the following:

angular.module('QuickList', []);

angular.module('QuickList').value('quickRepeatList', {});

angular.module('QuickList').directive('quickNgRepeat',
['$parse', '$animate', 'quickRepeatList', function($parse, $animate, 
quick_repeat_list) { 
  ...
  quick_repeat_list['foo'] = function() { ... }
}


angular-table now uses quick-ng-repeat:

angular.module('angular-table', ['QuickList']).service('ManualCompiler', 
['TemplateStaticState', function(TemplateStaticState) {
...
                rowTemplate = rowTemplate.replace('<tr',
                    '<tr quick-ng-repeat="row in model | 
orderBy:SortState.sortExpression:SortState.sortDirectionToColumnMap[SortState.sortExpression]
 
| filter:filterQueryModel" quick-repeat-list="items" ' +
                        selectedBackgroundColor + ngClick);
...
}

The demo:

angular.module('demo', ['angular-table', 'QuickList'])
    .controller('demoController', ['$scope', 'quickRepeatList', 
function($scope, quickRepeatList) {
        $scope.selectedRow = {};
        $scope.listOfNumbers = [];

        $scope.addRows = function(numberOfRowsToAdd) {
            var startIndex = $scope.listOfNumbers.length;
            var endIndex = $scope.listOfNumbers.length + numberOfRowsToAdd;

            for(var i = startIndex; i < endIndex; i++) {
                $scope.listOfNumbers.push({
                   id: i,
                   name: 'name ' + i,
                   street: 'street ' + i
                });
            }
        };

        $scope.handleRowSelection = function(row) {
            $scope.selectedRow = row;
        };

        $scope.addRows(1050);
        console.log(quickRepeatList);
        //quickRepeatList.items($scope.listOfNumbers);
    }]);


Here's a plunkr where I try to emulate what's going on, but it may or may 
not be the same:  http://plnkr.co/edit/d5sIDIOboRePAGRwVWSi?p=preview

-- 
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/groups/opt_out.

Reply via email to