Closed dwilt closed 8 years ago
This is a feature request. The current delegate handle implementation does not support dynamic handles. The delegate currently must exist when the slidebox directive is initialized.
You can work around this by editing the ionSlideBox directive in ionic-angular.js
Add delegateHandle: '@'
to the scope: {} definition
And change the $ionicSlideBoxDelegate._registerInstance
parameter from $attrs.delegateHandle
to $scope.delegateHandle
This work around only applies if the scope value assigning the delegate exists when the directive is instantiated. If you change it afterwards, expect bugs.
@meticoeus The issue with that would be of course that we use bower to manage all of our dependencies, so every time someone would do a bower install
they would be overwriting my local patch, no? If this is that easy, is it not something that can be merged in with a new Ionic release?
@dwilt You can fork Ionic, commit the changes in your fork, and point bower at the fork instead by passing the full git url rather than the repository name. Now everyone on your team that runs bower install will get the fork instead. Just pull changes into your fork when an update is released.
Thanks for opening this issue! If you have a patch for this issue i would definitely recommend opening a pull request for it, that would be awesome! At this time im gonna go ahead and close this issue, but feel free to reopen this issue if needed!
Short description of the problem:
I'm trying to call
slideTo
in my controller and it's not working. I've narrowed it down to when thedelegate-handle
in the template is being dynamically created (as shown in my controller code below), it fires this error when I callslideTo
:If I put a breakpoint inside of the
slideTo
and inspect thethis.$ionicSlideBoxDelegate._instances[0].$$delegateHandle
, I can see it's not using the interpolated value, but the controllerVariable and curly brackets:{{ tourSlider.delegateHandle }}
. While in this breakpoint, I've confirmed that thedelegateHandle
I'm using for$getByHandle
is indeed the same in both the controller and the template.I've tried putting
slider.slide
called intimeout
wrappers and using the$ionicSlideBoxDelegate.update()
before hand but neither works.What's also interesting, is that while in this breakpoint, if I call
this.$ionicSlideBoxDelegate.slide(0)
(without using the$getByHandle
), it slides.What behavior are you expecting?
I'm expecting it to slide.
In my template:
in my controller constructor:
in
slideTo
on my controller:Ionic Version: 1.2.4-nightly-1917
Browser & Operating System: iOS / Chrome (haven't tested in Android)
Run
ionic info
from terminal/cmd prompt: