각도 라우터를 설정하려고합니다.
나는 this 자습서를 따릅니다.
저는 bower를 사용하여 각 및 각 라우터를 설치하고이를 html로 나열했습니다. 모든 것이 예상대로로드됩니다 (콘솔에서 404 오류 없음). 따라서 스크립트가 있습니다.
<html>
<head>
<title>Miha Šušteršič</title>
<!-- JQUERY -->
<script src="assets/vendor/jquery/dist/jquery.min.js"></script>
<!-- FOUNDATION -->
<script src="assets/vendor/foundation-sites/dist/foundation.min.js"></script>
<!-- ANGULAR -->
<script src="assets/vendor/angular/angular.min.js"></script>
<script src="assets/vendor/angular-route/angular-route.min.js"></script>
<!-- APP -->
<script src="assets/js/app.min.js" type="text/javascript"></script>
<!-- FOUNDATION -->
<link rel="stylesheet" href="assets/vendor/foundation-sites/dist/foundation.min.css">
<!-- APP -->
<link rel="stylesheet" href="assets/css/main.css">
</head>
<body ng-app="IntroductionApp">
<!-- ANGULAR APP -->
<portfolio></portfolio>
<!-- FOUNDATION -->
<script>
$(document).foundation();
</script>
</body>
</html>
이제 기본 라우팅을 설정하려고합니다.
// MAIN ANGULAR JS FILE
angular
.module('IntroductionApp', ['ngRoute'])
.config(['$locationProvider', '$routeProvider',
function config($locationProvider, $routeProvider) {
$locationProvider.hasPrefix('!');
$routeProvider.
when('/landing', {
templateUrl: 'templates/landing.html'
}).
when('/portfolio', {
templateUrl: 'templates/portfolio.html'
}).
otherwise('/landing');
}
]);
가 지금은 콘솔에서 다음과 같은 오류가 점점 오전 :
angular.js:68 Uncaught Error: [$injector:modulerr] Failed to instantiate module IntroductionApp due to: TypeError: t.hasPrefix is not a function at http://localhost:48080/assets/js/app.min.js:1:108 at Object.invoke (http://localhost:48080/assets/vendor/angular/angular.js:4709:19) at runInvokeQueue (http://localhost:48080/assets/vendor/angular/angular.js:4602:35) at http://localhost:48080/assets/vendor/angular/angular.js:4611:11 at forEach (http://localhost:48080/assets/vendor/angular/angular.js:321:20) at loadModules (http://localhost:48080/assets/vendor/angular/angular.js:4592:5) at createInjector (http://localhost:48080/assets/vendor/angular/angular.js:4514:19) at doBootstrap (http://localhost:48080/assets/vendor/angular/angular.js:1751:20) at bootstrap (http://localhost:48080/assets/vendor/angular/angular.js:1772:12) at angularInit (http://localhost:48080/assets/vendor/angular/angular.js:1657:5) http://errors.angularjs.org/1.5.7/ $injector/modulerr?p0=IntroductionApp&p1=…2F%2Flocalhost%3A48080%2Fassets%2Fvendor%2Fangular%2Fangular.js%3A1657%3A5)
내가 잘못 뭐하는 거지이 (즉,이 angular.min.js로 컴파일됩니다) 내 app.js 파일?
당신이이 문제를 해결하기보다는'angular.min.js'보다 angular.js''로 변경해야해야 명확한 오류 메시지를 표시하지 마십시오. 또한, ng-app가있는 요소에'ng-strict-di'를 추가하여 Dependency Injection 오류를 발견 할 수 있습니다. – Claies
오류 로그 –