0

I am currently learning AngularJs and at the same time applying it to try and figure out how this viral movie site for the new x-men film was made ( http://www.trask-industries.com/#/innovation ) ...(you can google Trask Industries if you don't trust the link). From what I can understand, the xmen site navigation pulls in the html templates to the ng-view and within this, the ng-include pulls in the content from further html templates. However, this is the exact same set up for each webpage but the content within ng-include changes and I don't understand how this is possible? I would have thought that if the content to change for each page, the ng-include would have to point at different html templates but its not obvious how this is being done.

Here is the code that is included within the template the ng-view is pulling in...

<div id="two-column">
<div class="module_marquee"  ng-include="'modules/marquee.html'"></div>
<div class="module_list"  ng-include="'modules/list.html'"></div>
</div>

And as you can see, this code pulls in two further templates but its the same code for each page but the content changes depending on what link you click in the navigation. I hope that all makes sense and any help that will provide an explanation will be most appreciated.

1 Answers1

0

They are most likely using ng-src to set the template along with the ng-include directive. This article has details and examples: http://blog.dynamicprogrammer.com/2012/09/19/dynamic-includes-with-angular-js.html

Rob J
  • 6,609
  • 5
  • 28
  • 29