Javascript 为什么可以';我不能让Angularjs去工作吗?
我第一次尝试angularjs,但我觉得它在实际工作中遇到了困难 我在一个网站上做练习,当我在网站上运行它时,它会工作,但是当我试图跟随它并将它写在我自己的文件中时,我无法让它工作 例如:当我键入这个“{store.product.name}}”时,它会精确地打印出包含大括号的内容,但在站点上它会打印出“Azurite” 我的代码: index.htmlJavascript 为什么可以';我不能让Angularjs去工作吗?,javascript,angularjs,Javascript,Angularjs,我第一次尝试angularjs,但我觉得它在实际工作中遇到了困难 我在一个网站上做练习,当我在网站上运行它时,它会工作,但是当我试图跟随它并将它写在我自己的文件中时,我无法让它工作 例如:当我键入这个“{store.product.name}}”时,它会精确地打印出包含大括号的内容,但在站点上它会打印出“Azurite” 我的代码: index.html <!DOCTYPE html> <html ng-app="test"> <head> <l
<!DOCTYPE html>
<html ng-app="test">
<head>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<script src="app.js"></script>
<script src="angular.min.js"></script>
</head>
<body ng-controller="StoreController as store">
<div>
<h3>{{store.product.name}}</h3>
<h3>{{store.product.price}</h3>
</div>
</body>
</html>
你应该合上双曲括号 你有
<h3>{{store.product.price}</h3>
{{store.product.price}
应该是
<h3>{{store.product.price}}</h3>
{{store.product.price}
注意您应该关闭双曲括号 你有
<h3>{{store.product.price}</h3>
{{store.product.price}
应该是
<h3>{{store.product.price}}</h3>
{{store.product.price}
您的应用程序名称不正确
<html ng-app="gemStore"> </html>
gemStore
是您的应用程序名,而不是test
您的应用程序名不正确
<html ng-app="gemStore"> </html>
gemStore
是使用angular应用程序时应用程序的名称,而不是test
您首先需要angularJs脚本,其他人应该遵循
<!DOCTYPE html>
<html ng-app="gemStore">
<head>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<script src="angular.min.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="StoreController as store">
<div>
<h3>{{store.product.name}}</h3>
<h3>{{store.product.price}</h3>
</div>
</body>
</html>
{{store.product.name}
{{store.product.price}
如果你需要帮助,请告诉我
作为参考,您可以看到此plunker:
当你使用angular应用程序时 您首先需要angularJs脚本,其他人应该遵循
<!DOCTYPE html>
<html ng-app="gemStore">
<head>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<script src="angular.min.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="StoreController as store">
<div>
<h3>{{store.product.name}}</h3>
<h3>{{store.product.price}</h3>
</div>
</body>
</html>
{{store.product.name}
{{store.product.price}
如果你需要帮助,请告诉我
作为参考,您可以看到此plunker:
您使用的angular版本是什么?同时检查您的浏览器控制台,并分享您在本地运行服务器时遇到的错误?如果不是,这可能就是问题所在。简单地说,首先调用angular.min.js,然后调用app.js,因为您首先调用的是app.js。在您的app.js之前引用angular.min.js。是的,您的anularjs脚本始终应该d first您使用的angular的版本是什么?同时检查您的浏览器控制台,并分享您在本地运行服务器时遇到的错误?如果不是,这可能就是问题所在。很简单,首先调用angular.min.js,然后调用app.js,因为您首先调用的是app.js。在您的app.js之前参考angular.min.js是的,始终是您的anularjs脚本sho我觉得自己像个白痴哈哈,我可以发誓我做对了。谢谢你的帮助,它终于成功了!我觉得自己像个白痴哈哈,我可以发誓我做对了。谢谢你的帮助,它终于成功了!