1

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?

7
  • Can you show how you get JSON data? Do you use $http? Commented May 23, 2013 at 10:00
  • @the_lay like this: $routeProvider.when('/categories', { templateUrl: 'retrieve_xml.php?Xsl=categories.xsl', controller: 'CategoriesCtrl' }) Commented May 23, 2013 at 10:07
  • Can you show CategoriesCtrl? What is <div>{{ $scope.categories = [{},{},...]}}</div> for? Commented May 23, 2013 at 15:32
  • @sh0ber CategoriesCtrl is still empty function . i want to pass it some data after the template is loaded. Commented May 23, 2013 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. Commented May 24, 2013 at 6:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.