0
創建的模板列表需要創建一個JSON文件以獲取URL(路徑)的模板和創建的模板列表循環...從JSON帶環在JavaScript
我該怎麼辦錯誤?
//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>