javascript - Converting JSON to HTML in an angular.js app -
i have app supposed display book data (although have interactive content such quizzes). storing pages xml, like
<page> <image>http://someimage</image> <text>bla bla bla </text> <text>hello there </text> <image></image> <quiz type="multichoice"> <question>what first letter of alphabet</question> <answer>a</answer> <answer>b</answer> <answer>c</answer> </quiz> </page>
and there no restriction on order or amount of elements on given page. on web server, converting these javascript object (and caching it). until point.
but want client able request page, , have logic convert javascript object html. cannot figure out how write logic angular.js. cannot see obvious way of doing - ng-repeat work if wanted same html every element. in case want display image image, text paragraph, , quiz more complex. jade templating, trivial.
i want have working quickly, , concerned learning curve of angular going time waster. doing jade templating trivial, of course has downside of being server side.
some clarification: know how data client, requires using $http. don't understand @ how want data once @ client. whether json or xml irrelevant. need know how write code dynamically add html elements view, based on in data.
you need "working quickly" when familiar technology achieving results "trivial". you've answered own question - go know.
angular tool, takes time learn , upon doing can accomplish things. can solve problem, you'll need learn first. if answers how particular problem might solved angular, still need understand how develop , deploy angular application, not trivial using know.
Comments
Post a Comment