No worries, and thanks again for the reply.
I have changed it so it is like so:
<table id="header-questions" class="omniSearchable">
<tbody ng-controller="questionList">
<tr ng-repeat="question in questions" ng-include="question.HeaderText"></tr>
</tbody>
</table>
questionList controller grabs the questions and puts them into scope. I've
removed the {{}} as suggested, but it still doesn't work. Viewing the
element tab in Chrome dev tools I get:
<!-- ngRepeat: question in questions -->
<!-- ngInclude: question.HeaderText -->
<!-- end ngRepeat: question in questions -->
<!-- ngInclude: question.HeaderText -->
<!-- end ngRepeat: question in questions -->
...
It's like something has happened the right amount of times but it's
commented out. Any ideas?
On Thursday, 9 January 2014 17:01:01 UTC, Pan Stav wrote:
>
> It is, yea, I just don't use ngInclude unless I know I *might *not need
> some of the html it includes.
> Because if I am going to use it, could save the roundtrip, especially if
> it's 12 roundtrips we are talking about.
>
> It doesn't work because of the {{}}, I explained that in another reply,
> sorry for dup
>
> On Thursday, January 9, 2014 6:36:38 PM UTC+2, Fordio wrote:
>>
>> Thanks for your reply and sorry - I meant to put:
>> <table>
>> <tr ng-repeat="question in questions"
>> ng-include="{{question.HtmlTemplate}}"></tr>
>> </table>
>>
>> which didn't work.
>>
>> Isn't what you're suggesting very similar to this?
>>
>> On Thursday, 9 January 2014 16:31:23 UTC, Pan Stav wrote:
>>>
>>> I don't know know about setting ngRepeat on a table tag, but.. What is
>>> best for your app.
>>>
>>> Regrading your question, I'd suggest an ngRepeat that fills a custom
>>> directive with some attributes according to question type.
>>> The directive then constructs the appropriate html chunk for the
>>> particular question type. If you say you have 12 types, a directive with 12
>>> different scenarios then.
>>>
>>> Hope that helps
>>>
>>> On Thursday, January 9, 2014 5:49:35 PM UTC+2, Fordio wrote:
>>>>
>>>> Hi, I am working on an application that captures responses to
>>>> questions, a bit like a survey, and am looking for ideas to help me solve
>>>> the following problem.
>>>>
>>>> My app requests a list of questions from the a web service to ask the
>>>> user. The response to a question will be of a particular type. The
>>>> response
>>>> could be an integer response, a text, a date etc. (There are 12 different
>>>> types).
>>>>
>>>> For each question type, there is a different piece of HTML markup to
>>>> display the question and capture the response.
>>>>
>>>> There could be any number of questions returned from the web service,
>>>> with any combination of types.
>>>>
>>>> How can I use AngularJS to list the questions with the right markup for
>>>> each one?
>>>>
>>>> I have tried:
>>>>
>>>> <table ng-repeat="question in questions">
>>>> <tr ng-include="{{question.HtmlTemplate}}"></tr>
>>>> </table>
>>>>
>>>> Where question.HtmlTemplate is the url for the template for this
>>>> question type - but this doesn't work.
>>>>
>>>>
>>>>
--
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/groups/opt_out.