fundoo-solutions / angularjs-carousel Goto Github PK
View Code? Open in Web Editor NEWAn Angular Carousel Directive that allows for deferred loading of the pages
An Angular Carousel Directive that allows for deferred loading of the pages
Would be considered invalid if using multiple carousels on the same page.
I'm getting an error deep in the Angular library when trying to use the carousel in my project.
TypeError: undefined is not a function
at new ngDirective.controller (http://localhost/lib/angular/angular.js:13962:5)
at invoke (http://localhost/lib/angular/angular.js:2864:28)
at Object.instantiate (http://localhost/lib/angular/angular.js:2874:23)
at http://localhost/lib/angular/angular.js:4759:24
at http://localhost/lib/angular/angular.js:4338:17
at forEach (http://localhost/lib/angular/angular.js:138:20)
at nodeLinkFn (http://localhost/lib/angular/angular.js:4323:11)
at compositeLinkFn (http://localhost/lib/angular/angular.js:3969:15)
at publicLinkFn (http://localhost/lib/angular/angular.js:3874:30)
at http://localhost/lib/carousel.js:317:13 <div ng-mouseenter="pause()" ng-mouseleave="play()" class="carousel ng-isolate-scope ng-scope" data-carousel="" data-on-page-upcoming="loadPage(page, tmplCb)" data-give-carousel-to="onCarouselAvailable(carousel)">
Some background: our application is structured a bit differently than the sample. It uses routes, which specify controllers and the controllers are in a separate file. To start out, I borrowed the FlickrApi factory, CSS classes and controller functions, just to minimize the differences. So the overall effect should have been simply running the sample in the context of one of my partials, the underlying controller of which was modified to contain the same functions used by the example.
The problem seems related to initializing the carousel. Sometime after the function specified by the data-on-page-upcoming attribute runs, Angular is invoked and the exception shown above appears in the Javascript console.
What's failing is this Angular code. Specifically, $transclude is undefined.
var ngTranscludeDirective = ngDirective({
controller: ['$transclude', '$element', function($transclude, $element) {
$transclude(function(clone) {
$element.append(clone);
});
}]
});
Does something need to be done to define $transclude? I've Googled around but haven't found a good answer. I did try setting "transclude" to true in the carousel directive. This didn't help and, truth be told, I don't know what it actually does.
Final note, I'm using a slightly newer Angular: 1.0.6. I tried to use the version used in the example (1.0.4)and it failed with the same error.
Would be nice if any style rules were separated into a stylesheet, or otherwise optional.
Using ng-animate to handle the animations would be awesome.
Since I installed angularjs version 1.2.1, an error raises when Angular processes the Carousel directive.
Error: [$compile:multidir] Multiple directives [carousel, carousel] asking for new/isolated scope.
Looks like the name "carousel" for the directive is conflictive with another variable. I've changed the name of the directive by myCarousel (HTML: data-my-carousel) and that solved the error.
Best!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.