Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I get my html template + json data from xsl translator , it is dynamic , it looks like html code plus some data in stringified json. The question is: in what way i put the json string in html code , so that controller will catch this json data before html rendering? When i simple put it like this:

<div>{{ $scope.categories = [{},{},...]}}</div>
<div ng-repeat="category in categories" class="category">...</div>

it works good , but brings some strange error:

Error: 10 $digest() iterations reached. Aborting!

So what is the good way to pass data from view to controller?

share|improve this question
Can you show how you get JSON data? Do you use $http? – Iļja Gubins May 23 at 10:00
@the_lay like this: $routeProvider.when('/categories', { templateUrl: 'retrieve_xml.php?Xsl=categories.xsl', controller: 'CategoriesCtrl' }) – Cherniv May 23 at 10:07
Can you show CategoriesCtrl? What is <div>{{ $scope.categories = [{},{},...]}}</div> for? – sh0ber May 23 at 15:32
@sh0ber CategoriesCtrl is still empty function . i want to pass it some data after the template is loaded. – Cherniv May 23 at 16:59
@Cherniv I can suggest you make it a little bit another way: in controller put $http.get(retrieve_xml.php?Xsl=categories.xsl).success(function (result) { $scope.categories = result; }. This way categories variable will have all the data it got from your .xml file and then it can properly render html. – Iļja Gubins May 24 at 6:58
show 2 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.