我目前正在使用meanjs作为项目的框架。我被困在旋转木马不能工作。基本上,我通过删除addSlide()来保持简单,因为我只打算显示幻灯片。但它甚至没有工作,控制台抛出了一个我不明白的错误。有人能指出我正确的方向吗?
angular.module('core').controller('CarouselController', ['$scope',
function($scope) {
$scope.interval = 3000;
$scope.slides = [
{image: 'http://placekitten.com/200/200',text: 'Kitten.'},
{image: 'http://placekitten.com/225/200',text: 'Kitty!'},
{image: 'http://placekitten.com/250/200',text: 'Cat.'},
{image: 'http://placekitten.com/275/200',text: 'Feline!'}
];
}
])
.directive('disableAnimation', function($animate){
return {
restrict: 'A',
link: function($scope, $element, $attrs){
$attrs.$observe('disableAnimation', function(value){
$animate.enabled(!value, $element);
});
}
};
});
<div ng-controller="CarouselController">
<div style="height:305px">
<carousel interval="interval" disable-animation="true">
<slide ng-repeat="slide in slides" active="slide.active">
<img ng-src="{{slide.image}}" style="margin:auto;" />
<div class="carousel-caption">
<h4> Slide {{$index}}</h4>
<p>{{slide.text}}</p>
</div>
</slide>
</carousel>
</div>
</div>
控制台上的错误说明:
TypeError: undefined is not a function at link (../lib/angular-bootstrap/ui-bootstrap-tpls.js:684:20) at ../lib/angular/angular.js:7113:44 at nodeLinkFn (../lib/angular/angular.js:6711:13) at delayedNodeLinkFn (../lib/angular/angular.js:6933:11) at compositeLinkFn (../lib/angular/angular.js:6105:13) at publicLinkFn (../lib/angular/angular.js:6001:30) at boundTranscludeFn (../lib/angular/angular.js:6125:21) at controllersBoundTransclude (../lib/angular/angular.js:6732:18) at ngRepeatAction (../lib/angular/angular.js:20625:15) at Object.$watchCollectionAction [as fn] (../lib/angular/angular.js:12409:13) <div ng-class="{ 'active': leaving || (active && !entering), 'prev': (next || active) && direction=='prev', 'next': (next || active) && direction=='next', 'right': direction=='prev', 'left': direction=='next' }" class="item text-center ng-isolate-scope" ng-transclude="" ng-repeat="slide in slides" active="slide.active"> angular.js:10071 Resource interpreted as Image but transferred with MIME type text/plain: "http://placekitten.com/200/200".