我收到“announcementCtrl”不是函数的错误消息?有人可以告诉我我在这里做错了什么。它明确定义了,所以发生了什么?这是我的 JavaScript:
(function() {
var app = angular.module('announcementApp', []);
app.controller('announcementCtrl', function() {
this.announcements = announcementsArray;
});
var announcementsArray = [
{
type: 'UPDATE',
announcement: 'DISA Maps are almost complete! Look foward to reporting out at the project share next week.'
},
{
type: 'SHOUT-OUT',
announcement: 'Great work to Lawson and Patrick on Innovation Cell. We are gaining more strategic position and proving our value everyday.'
},
{
type: 'EVENT',
announcement: 'Dr. Chipley will be visiting 3/20/2015 to talk Cybersecurity'
}
];
})();
这是我的 HTML:
<div class="row row2" ng-app="announcementApp">
<section class="sub-box client-box">
<div class="announcements" ng-controller="announcementCtrl as announcements">
<div class="announcement-block" ng-repeat="eachAnnouncement in announcements">
<div class="event-highlight update"></div>
<div class="wrap">
<div class="announcement-description">{{eachAnnouncement.type}}</div>
<div class="announcement">{{eachAnnouncement.announcement}}</div>
</div>
</div>
</div>
</section>
</div>