I have created a specialized angular directive shown below:
dirs.directive('sectionInfo', function(){
return {
restrict: 'E',
templateUrl: 'partials/section-home.html',
transclude: true,
controller: function($scope, $routeParams){
var section = this;
section.sectionItem = [];
client.entries({"some params"},
function(err, entries){
if (err) { console.log(err); return; }
$scope.$apply(function(){
section.sectionItem = entries;
});
}
);
},
controllerAs: 'sectionCtrl'
}
});
This content is then presented in a distinct partial page that resembles:
<section-info></section-info>
<ul class="list-group">
<li class="list-group-item" ng-repeat="entry in entriesCtrl.index_items">
<a href="#/entries/{{entry.sys.id}}">
<h4>{{entry.fields.title}} <small>{{entry.fields.author}}</small></h4>
</a>
</li>
</ul>
The partial template code simply looks like:
{{sectionCtrl.sectionItem}}
Upon loading this page and retaining the $scope$apply call, an error is triggered:
Error: error:interr Interpolation Error Can't interpolate: {{sectionCtrl.sectionItem}} TypeError: Converting circular structure to JSON
If I eliminate the $scope.$apply call, the error disappears. Any insights into what could be causing the circular reference issue within the $scope.$apply call?
EDIT: The content of entries and the error message captured in the console log.