javascript - Unable to dynamically ng-include angular template in ng-repeat -
i'm attempting include templates dynamically using following code. seems work until enter ng-repeat scope. i'm using angular1.2rc1.
http://plnkr.co/edit/s2e2w5pmmjrmwrgzkjw4?p=preview
angular.module('myapp', []). controller('myctrl', function($scope) { $scope.templatename = 'template1.html'; $scope.templateconfig = [ { templatename : 'template2.html' }, { templatename : 'template3.html' } ]; }); <body ng-controller="myctrl"> <div ng-include src="templatename"></div> <div ng-repeat="template in templateconfig"> <div ng-include src="template.templatename"></div> </div> </body>
replace
<script data-require="angular.js@1.2.0-rc1" data-semver="1.2.0-rc1" src="http://code.angularjs.org/1.2.0rc1/angular.js"></script>
with
<script src="http://code.angularjs.org/1.2.0-rc.2/angular.js"></script>
new working plunker on http://plnkr.co/edit/vdwk9h7r4vagkkuthrf0
Comments
Post a Comment