[英]How to use angular with require
I am attempting to display a list of items using angular loaded via require. 我正在尝试使用通过require加载的角度显示项目列表。
I have two files 我有两个档案
index.html index.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test App</title>
<script data-main="/Scripts/app/main" src="../Scripts/lib/require.js"></script>
</head>
<body ng-controller="AppCntrl">
<ul>
<li ng-repeat="phone in appCntrl.phones">
{{phone.name}}
<p>{{phone.snippet}}</p>
</li>
</ul>
</body>
</html>
and main.js 和main.js
require.config({
baseUrl: '/Scripts/',
urlArgs: "bust=" + (new Date()).getTime(),
paths: {
'angular': 'lib/angular/angular.min',
'angular-resource': 'lib/angular/angular-resource.min'
},
shim: {
'angular': { 'exports': 'angular' },
'angular-resource': { deps: ['angular'] }
}
});
require(['angular', 'angular-resource'], function (angular) {
var mainMod = angular.module('mainMod', ['ngResource']);
mainMod.controller('AppCntrl'['$scope', function ($scope) {
$scope.phones = [
{
'name': 'Nexus S',
'snippet': 'Fast just got faster with Nexus S.'
},
{
'name': 'Motorola XOOM™ with Wi-Fi',
'snippet': 'The Next, Next Generation tablet.'
},
{
'name': 'MOTOROLA XOOM™',
'snippet': 'The Next, Next Generation tablet.'
}
];
}]);
angular.bootstrap(document, ['mainMod']);
});
I am not getting any console errors. 我没有收到任何控制台错误。 Just an empty page 只是一个空白页
UPDATE UPDATE
I made an update and now getting Error[ng:areq] I think this is progress 我进行了更新,现在出现错误[ng:areq],我认为这是进步
UPDATE2 UPDATE2
I am not getting error 我没有收到错误
Cannot call method '$$minErr' of undefined
UPDATE 3 更新3
Error: [ng:areq]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.