diff --git "a/04_\346\211\213\345\267\245\346\226\267\350\251\236/index.html" "b/04_\346\211\213\345\267\245\346\226\267\350\251\236/index.html" index 30829fa..1f4c5c7 100644 --- "a/04_\346\211\213\345\267\245\346\226\267\350\251\236/index.html" +++ "b/04_\346\211\213\345\267\245\346\226\267\350\251\236/index.html" @@ -29,11 +29,13 @@ - {{$index}}{{word.shape}} + {{$index + start}}{{word.shape}} - + + + 後一組 diff --git "a/04_\346\211\213\345\267\245\346\226\267\350\251\236/script.js" "b/04_\346\211\213\345\267\245\346\226\267\350\251\236/script.js" index 0e50f04..de17864 100644 --- "a/04_\346\211\213\345\267\245\346\226\267\350\251\236/script.js" +++ "b/04_\346\211\213\345\267\245\346\226\267\350\251\236/script.js" @@ -10,12 +10,15 @@ app1.controller("showController",["$scope","$location","$http","$q",function($sc //$scope.str3="\u9023\u5b57\u97f3"; /* 秀出json資料的方法 */ //JSON.stringify(jsondata) - + $scope.start = 0; + $scope.showtextarea = false; + var searchObject = $location.search(); $scope.mainInfo = $http.get("./答案.txt").success(function(data) { //1.讀入十句 - $scope.input10 = data.slice(searchObject.start,searchObject.start + 10); - + $scope.start = +searchObject.start; + $scope.end = +searchObject.start+10; + $scope.input10 = data.slice($scope.start,+$scope.end); //2.初始化每一句要斷詞的句子 (anguarJS無法顯示{{中文變數}}) angular.forEach($scope.input10,function(每一句, 索引值){ @@ -63,7 +66,7 @@ app1.controller("showController",["$scope","$location","$http","$q",function($sc var 輸出所有句 = []; var 總長度 = $scope.input10.length; for(var i=0; i<總長度; i++) { - var 每一句 = ""; + var 每一句 = ""+($scope.start+i)+", "; var 字數 = $scope.input10[i][0][0].words.length; for(var j=0; j<字數; j++){ var 字 = $scope.input10[i][0][0].words[j]; @@ -71,7 +74,8 @@ app1.controller("showController",["$scope","$location","$http","$q",function($sc } 輸出所有句.push(每一句.slice(0,-1)); } - alert(輸出所有句); + $scope.sui2=輸出所有句.join('\n')+'\n'; + $scope.showtextarea=true; };