我有两个html文件,我需要让它们以角度显示。
这是我的js:
var app = angular.module('test', ['ui.bootstrap','ngRoute']);
app.controller('submitController', ['$scope','$http','$timeout',function($scope, $http, $timeout) {
$http.get('podaci.json').success(function(data) {
$scope.data = data;
$scope.counter = $scope.data.vreme;
});
$scope.countdown = function() {
$timeout(function() {
if( $scope.counter > 0 ){
$scope.counter--;
}
/* else
go to the other page */
$scope.countdown();
}, 1000);
};
$scope.answers = [];
$scope.text = '';
$scope.submit = function() {
if ($scope.text) {
$scope.answers.push(this.text);
$scope.text = '';
}
};
$scope.remove = function($index) {
$scope.answers.splice($index, 1);
}
}]);
app.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'templates/quiz.html',
controller: 'SubmitController'
}).
when('/result', {
templateUrl: 'templates/result.html',
controller: 'ResultController'
}).
otherwise({
redirectTo: '/'
});
}]);
这是quiz.html,第二个html是空的:
页面上有一个计时器,当时间到了,它应该转到另一页。或者当你点击我还没有制作的按钮时。但我无法显示第二页。