Benötigen Sie eine Schleife in einer JSON-Datei zu erstellen, die URL (Pfad) zu den Vorlagen zu erhalten und eine Liste von Vorlagen erstellen ...Erstellen Sie eine Liste von Vorlagen von einem json mit Schleife in JavaScript
Was ich tue falsch?
//get the JSON file from the server
$http.get('static/titles.json').success(function(doc){
\t \t $scope.docs = doc;
\t \t //preenche os templates a partir do JSON.
\t \t fillTemplatesList();
\t }).error(function(error){
\t \t console.log(error);
\t });
$scope.templates = [];
\t function fillTemplatesList() {
\t \t for (var i = 0; i < $scope.docs.length; i++) {
\t \t \t $scope.templates[i].url = $scope.docs[i].url;
\t \t \t console.log($scope.templates.url);
\t \t }
\t \t
\t }
//when user clicks, the page changes.
$scope.cliked = function(index){
\t \t $scope.template = $scope.templates[index];
\t \t console.log(index);
\t };
<div id="container-doc" class="col s9">
<br>
<div class="container left" ng-include="template.url">
</div>
</div>