我是Angular JS的新手,我在NG控制器中面臨一些問題,它不會將值發送到瀏覽器屏幕。我正在使用角1.5.8。我怎樣才能得到這個代碼,以顯示values.Attached是我的輸出以及 這裏是我的代碼: 的script.jsng控制器不呈現數據到瀏覽器
(function() {
var gem = {
name: "Dodecahedron",
price: 2.95,
description: "great stone"
};
var app = angular.module('store', []);
app.controller('StoreController', function() {
this.product = gem;
});
})();
HTML文件
<!DOCTYPE html>
<html data-ng-app="store">
<head>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript" src="script.js" ></script>
<link rel="stylesheet" type="text/css" href="bootstrap/bootstrap/css/bootstrap.min.css">
<meta charset="UTF-8">
<title>Angular Demo</title>
</head>
<body >
{{"Hello" + "Angular"}}
<br />
Here is Where our gem information will be displayed through the controller.
<div ng-controller="StoreController">
{{"Hello" + "Angular"}}
<h1>Product name : {{StoreController.product.name}}</h1>
<h2>Produce Price : {{StoreController.product.price}}</h2>
<p>Product Description : {{StoreController.product.description}}</p>
</div>
</body>
</html>
謝謝哥們。有效 –