我是AngularJS的新手,我在Chrome浏览器中没有获得任何输出。
但是,当我通过Bracket(Chrome)运行它并转到开发人员工具后,我收到以下错误消息:
无法加载资源:http://127.0.0.1:55291/favicon.ico无法加载资源:服务器响应状态为404(未找到)
HTML:
<!DOCTYPE html>
<html lang="en" ng-app="gemStore">
<head>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="shared/bootstrap-4.0.0-alpha.5-dist/css/bootstrap.min.css" />
</head>
<body ng-controller="StoreController as store">
<!-- Include the AngularJS library -->
<script src='shared/angular.min.js'></script>
<script src='js/app.js'></script>
<div class="product row" ng-hide="store.product.soldOut">
<h3>
{{store.product.name}}
<em class="pull-right">${{store.product.price}}</em>
</h3>
<button ng-show="store.product.canPurchase">Add to Cart</button>
</div>
</body>
</html>
JS:
(function() {
var app = angular.module('gemStore', []);
app.controller('StoreController', function(){
this.product = gem;
});
var gem = {
name: 'Azurite',
price: 110.50,
canPurchase: true,
soldOut: true
};
})();