我试图使用角度js创建一个页面,它给了我这个错误:未捕获错误:[$ injector:modulerr] http://errors.angularjs.org/1.6.3/ $ injector / modulerr?p0 = store& p1 = Error% 3A%2 ... F%2FC%3A%2FUsers%2Fhp%2FDesktop%2FAngular%2Fjs%2Fangular.min.js%3A22%3A179)
这是我的代码:
[ecx+eax*4]

(function () {
var app = angular.module('store', ['ngRoute']);
app.controller('StoreController', function () {
this.products = gems;
});
var gems = [
{
name: 'Dodecahedron',
price: 2.95,
description: 'Some gems have hidden qualities beyond their luster, beyond their shine... Dodeca is one of those gems.',
canPurchase: true,
soldOut: true,
},
{
name: 'Pentagonal Gem',
price: 5.95,
description: 'Some gems have hidden qualities beyond their luster, beyond their shine... Dodeca is one of those gems.',
canPurchase: true,
soldOut: true,
},
];
});

答案 0 :(得分:2)
您没有调用立即调用的函数,它应该是:
(function () {
//your code as it is...
})();
(注意最后的()
)。
作为旁注,您不需要注入ngRoute
。