created demo of dynamic templates

This commit is contained in:
okalintu
2016-08-29 20:01:10 +03:00
parent 7149e574f2
commit 61325b57c6
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -1 +1 @@
<h1>testi1</h1>
<h1>testi1 {{ testparam }}</h1>
+11 -3
View File
@@ -3,9 +3,17 @@ var app = angular.module('infoApp', []);
app.controller('infoscreen_main', function($scope, $http,$timeout){
var index = -1;
var templates = [
"/static/html/test1.html",
"/static/html/test2.html",
"/static/html/test3.html",
{
template: "/static/html/test1.html",
onload: function(){$scope.testparam = "foo";}
},{
template: "/static/html/test2.html"
},{
template: "/static/html/test1.html",
onload: function(){$scope.testparam = "bar";}
},{
template: "/static/html/test3.html"
},
];
$scope.next = function(){
index = (index + 1) % templates.length;
+1 -1
View File
@@ -15,7 +15,7 @@
</head>
<body>
<div class="jumbotron" ng-controller="infoscreen_main">
<div id="infocontent" ng-include="active"></div>
<div id="infocontent" ng-include="active.template" onload="active.onload()"></div>
</div>
</body>
</html>