I've created a directive that contains an ng-grid. I've had problems with
the grid loading data when in a directive and the data is retrieved via
ajax in teh directives controller. So, to fix it the directive template
specifies another controller for the ng-grid.
Example directive template:
<div>
<div class="pageheader">{{pagemodel.labels.coCustListHeader}}</div>
<div>
<div>{{pagemodel.labels.coFilterDrpdwn}}</div>
<select ng-change="filterPriority()" ng-model="priorityFilter">
<option ng-repeat="filteroption in
pagemodel.labels.filteroptions"
value="{{filteroption.value}}">{{filteroption.text}}</option>
</select>
</div>
<div id="customergrid" ng-controller="*GridController*">
<div id="grid" class="gridStyle" ng-grid="gridOptions"></div>
</div>
</div>
In the GridController contains the gridOptions and the grid data which is
retrieved via AJAX. Because this is inside my directive I expect that the
GridController is a child of the directive's controller and there for would
be accessible from teh directive's controller via $scope.$child. However,
$child is not recognized and when I use Firebug to debug it show that there
is a property called $$childHead but that doesn't seem to work either even
though it does show my grid data property. So, (because I'm kind of a
newbie to Angular) I'm stuck. Below is a method on my directives
controller where I'm trying to get access to the grid data in the
GridController (and failing).
$scope.filterPriority = function() {
$scope.$child.gridData =
$scope.$$childhead.gridData.filter(filterTest());
if (!$scope.$child.$$phase) {
$scope.$child.$apply();
}
};
$scope.filterTest = function(obj, idx, arr) {
return obj.priority === $scope.priorityFilter;
};
--
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.