Mam naprawdę dziwny błąd, ustawiłem trasy i kontrolery. Teraz mam tylko pustą stronę bez błędów?AngularJS: ngRoute, w przeciwnym razie nie działa
index.html;
<!DOCTYPE html>
<html ng-app="RekenTalent" lang="nl">
<head>
<title>Rekentalent.nl: Ben jij een talent in Rekenen?</title>
<!-- Stylesheets -->
<link rel="stylesheet" type="text/css" href="/app/front/assets/stylesheets/style.css">
<!-- AngularJS -->
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular-route.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular-animate.min.js"></script>
<!-- Controllers -->
<script src="/app/front/controllers/controller.js"></script>
<!-- Router -->
<script src="/app/front/router.js"></script>
</head>
<body ng-view></body>
</html
>
Controller.js:
/**
* RekenTalent
*
* Copyright 2014 - Rekentalent.nl
*/
var RekenTalent = angular.module('RekenTalentControllers', []);
RekenTalent.controller('rekenCtrl', ['$scope', function($scope){
}]);
Router.js:
var RekenTalent = angular.module('RekenTalent', [
'ngRoute', 'RekenTalentControllers'
]);
RekenTalent.config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/index', {
templateUrl: '/templates/index.html',
controller: 'rekenCtrl'
}).
otherwise({
redirect: '/index'
});
}]);
I /templates/index.html mówi po prostu 'cześć'. Czy ktoś wie, dlaczego dostaję pustą stronę? Powinien przekierować mnie do /index.html i /index.html powinien używać szablonu /templates/index.html. Co to jest problem i naprawa?
UPDATE:
kiedy idę do/index to działa, więc inaczej param pracy doesn `, dlaczego nie?
Myślę, że to błąd odsyłacza do pliku, proszę podać nam, gdzie jest twój indeks, oraz skrypty kątowe na komputerze. – Milad
Możesz dodać konsolę.log ('load') w twoim kontrolerze, aby sprawdzić, czy term kontroler jest wypalany poprawnie czy nie Ale nadal myślę, że jego błąd odniesienia – Milad
index.html => /app/front/templates/index.html, także po umieszczeniu konsoli .log ("cześć") w kontrolerze nie mam logu w konsoli. – DazDylz