Closed Assdi closed 6 years ago
Same here. Is this not supported?
quick solution is to push the controller object in slides object
I nicer option is to add another directive scope prop, and pass your scope into there. In https://github.com/mihnsen/ui-carousel/blob/master/src/ui-carousel/directives/carousel.directive.js
where it defines the scope, add another key like scope: '='
.
Then when using the directive pass in your scope (or any other object your want, really);
<ui-carousel ... scope='$scope'>
Then inside the item you can use it as ctrl.scope.yourScopeProp
.
@Assdi how can I do that?
e.g if u have obj vm.solution (in controller) and u want to access it in carousel html then u can push the vm.solution into carousel object. In above case I have pushed into slides="vm.independentQuizes"
Yeah I was doing that but needed to access a function in my controller from the crousel-item to display some info and could do that. I ended up preprocessing the items to show in order to load the info to the objects as a property.
Anyway, thanks for your time to respond!!
now i stuck in problem I have to call controller function here :( @martinmanzo
yahoo Ive done that :+1:
How?
same solution :D push the function reference into slide obj . just i did above for controller scope @illuska812
$scope.myFunction=function(){console.log('hi')}
and push this function ref into slide obj like this
vm.slides.myfunc=myFunction
e.g `<ui-carousel slides="vm.independentQuizes" slides-to-show="4" slides-to-scroll="4" on-init="vm.onCarouselInit()" on-before-change="vm.before()" on-after-change="vm.yo(currentSlide)">
Quiz {{vm.as}}
{{item.Name}}