angularjs - Dynamic templateUrl based on attribute value -


Assume that I have this data that represents the page made up of various panels ...

< {"Id": "panel2", "type": "panel", "type", "more info", " , // data}]}

... and I'm trying to do something like this:

  // template & lt; Section ng-repeat = "panel in panel" & gt; My panel panel-data = "{{panel}}" & gt; & Lt; / Div & gt; & Lt; / Section & gt; // Director's App Directional ('myPanel', function () {return {radius: {panel: '= panel data'}, template url: function () {// panel.type ('carousel' or 'quote') The template determines to load}});  

What should my templateUrl function be?

Put the argument in the template :

  // directory application guidelines ('myPanel', function () {return {radius: {panel: '= panel data'}, template: '
> + '& lt; div ng- switch-when = "quote "Ng- included =" quote.html "> gt; & lt; / div & gt; '+' '});

Comments