Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Dependency fixes. owlCarousel is not a function fixes #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
bower_components
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history
5 changes: 4 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
"bower_components",
"test",
"tests"
]
],
"dependencies": {
"owl-carousel": "^1.3.2"
}
}
18 changes: 10 additions & 8 deletions src/angular-owl-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,28 @@
return {
restrict: 'A',
scope: {
owlOptions: '=owlOptions'
owlOptions: '=owlOptions',
owlCarousel: '=owlCarousel'
},
transclude: true,
link: function (scope, element, attributes, controller, $transclude) {

var options = {},
$element = $(element),
owlCarousel = null,
propertyName = attributes.owlCarousel;
owlCarousel = null;

for (var optionValue in owlOptions) {
var currentOptionValue = owlOptions[optionValue];
if (scope.owlOptions[currentOptionValue] !== undefined) {
options[currentOptionValue] = scope.owlOptions[currentOptionValue];
}
if (owlOptions.hasOwnProperty(optionValue)) {
var currentOptionValue = owlOptions[optionValue];
if (scope.owlOptions[currentOptionValue] !== undefined) {
options[currentOptionValue] = scope.owlOptions[currentOptionValue];
}
}
}

element.addClass('owl-carousel');

scope.$watchCollection(propertyName, function (newItems) {
scope.$watchCollection('owlCarousel', function (newItems) {

if (owlCarousel) {
owlCarousel.destroy();
Expand Down