我正在寫.HTML代碼,並在此我對js文件名作爲調用chart_buttons.jsjavascript文件沒有要求
HTML代碼:
<html ng-app>
<head>
<title>
Chart
</title>
<!-- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -->
<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script type="text/javascript" src="chart_buttons.js"></script>
</head>
<body ng-controller="Channels">
<p>Set:
<label ng-repeat="n in [0,1]">
<input type="radio" name="pageSet" ng-value="n"/>{{n}}
</label>
</p>
<p>Page:
<label ng-repeat="n in [0,1,2,3]">
<input type="radio" name="pageNumber" ng-model="$parent.pageNumber" ng-value="n" /> {{n}}
</label>
</p>
<ul>
<li ng-repeat="channel in channels | limitTo: groupSize * ((groupSize * pageSet) + pageNumber + 1) | limitTo: -groupSize">
<p>{{channel.id}}</p>
</li>
</ul>
</body>
</html>
我的Java代碼,紙條
chart_buttons.js
function Channels($scope) {
alert("hiiii");
$scope.groupSize = 4;
$scope.pageSet = 0;
$scope.pageNumber = 0;
$scope.channels = [
{"id": "Ch-001"}, {"id": "Ch-002"}, {"id": "Ch-003"}, {"id": "Ch-004"},
{"id": "Ch-005"}, {"id": "Ch-006"}, {"id": "Ch-007"}, {"id": "Ch-008"},
{"id": "Ch-009"}, {"id": "Ch-010"}, {"id": "Ch-011"}, {"id": "Ch-012"},
{"id": "Ch-013"}, {"id": "Ch-014"}, {"id": "Ch-015"}, {"id": "Ch-016"},
{"id": "Ch-017"}, {"id": "Ch-018"}, {"id": "Ch-019"}, {"id": "Ch-020"},
{"id": "Ch-021"}, {"id": "Ch-022"}, {"id": "Ch-023"}, {"id": "Ch-024"},
{"id": "Ch-025"}, {"id": "Ch-026"}, {"id": "Ch-027"}, {"id": "Ch-028"},
{"id": "Ch-029"}, {"id": "Ch-030"}, {"id": "Ch-031"}, {"id": "Ch-032"}
];
}
angular.module('app', []).controller('Channels', Channels);
angular.bootstrap(document.body, ['app']);
但是當我執行的代碼它沒有顯示ASY輸出... 因此我在.js文件中發出警報,但它也沒有顯示警報。所以任何一個可以指導我在哪裏,我在編碼請
移動從功能(或更好的外部警報出了錯,離開只警覺)。控制檯中是否有錯誤? – Justinas 2014-09-19 12:10:18
有你包括角js文件,因爲我沒有看到任何在你的HTML – 2014-09-19 12:11:22
不,我沒有添加任何角度js文件。是否需要添加?因爲我沒有鏈接。 – user2099759 2014-09-19 12:26:36