私はangularjsを初めて使用しています。私はindex.htmlでシンプルなコントローラをテストしようとしています。しかし、私は私のローカルホスト上でそれを実行していたとき、私はエラーを取得しています:ここでリソースを読み込めません
Failed to load resource: the server responded with a status of 404 (Not Found).
は私のフォルダ構造である:ここで
angulartesting
-bower_components
-index.html
-script.js
は私のindex.htmlファイルです:
<!-- index.html -->
<!DOCTYPE html>
<html ng-app="store">
<head>
<!-- SCROLLS -->
<!-- load bootstrap and fontawesome via CDN -->
<link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- SPELLS -->
<!-- load angular and angular route via CDN -->
<script src="/bower_components/angular/angular.min.js"></script>
<script src="/bower_components/angular-route/angular-route.js"></script>
<script src="script.js"></script>
</head>
<body >
<div ng-controller="StoreController as store">
<h1>{{store.product.name}}</h1>
<h2>${{store.product.price}}</h2>
</div>
<script src="bower_components/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>
ここに私のscript.jsがあります:
// create the module and name it scotchApp
// also include ngRoute for all our routing needs
(function(){
var app = angular.module('store', []);
app.controller('StoreController',function(){
this.product=gem;
});
var gem = {
name:'Gaurav',
price:'220'
}
})();
誰かが私が間違っていることを教えてもらえますか?
ローカルサーバー上で実行しています。
を役に立てば幸いJavaScriptでラインから来る誤りのですか?通常は404エラーとともに、URLまたはファイルが見つかりませんでした。 –
正確に何を得ているのかという質問のエラーメッセージを更新してください。 –
JavaScriptの行から来ないものはありません@Scott Selby –