私は現在、プロジェクトに取り組むためのフレームワークとして 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".