|
1 | 1 | /** |
2 | 2 | * Angular Carousel - Mobile friendly touch carousel for AngularJS |
3 | | - * @version v1.0.2 - 2016-11-25 |
| 3 | + * @version v1.0.2 - 2017-08-03 |
4 | 4 | * @link http://revolunet.github.com/angular-carousel |
5 | 5 | * @author Julien Bouquillon <julien@revolunet.com> |
6 | 6 | * @license MIT License, http://www.opensource.org/licenses/MIT |
@@ -458,6 +458,25 @@ angular.module('angular-carousel').run(['$templateCache', function($templateCach |
458 | 458 | angular.forEach(getSlidesDOM(), function(node, index) { |
459 | 459 | currentSlides.push({id: index}); |
460 | 460 | }); |
| 461 | + if (iAttributes.rnCarouselHtmlSlides) { |
| 462 | + var updateParentSlides = function(value) { |
| 463 | + slidesModel.assign(scope.$parent, value); |
| 464 | + }; |
| 465 | + var slidesModel = $parse(iAttributes.rnCarouselHtmlSlides); |
| 466 | + if (angular.isFunction(slidesModel.assign)) { |
| 467 | + /* check if this property is assignable then watch it */ |
| 468 | + scope.$watch('htmlSlides', function(newValue) { |
| 469 | + updateParentSlides(newValue); |
| 470 | + }); |
| 471 | + scope.$parent.$watch(slidesModel, function(newValue, oldValue) { |
| 472 | + if (newValue !== undefined && newValue !== null) { |
| 473 | + newValue = 0; |
| 474 | + updateParentIndex(newValue); |
| 475 | + } |
| 476 | + }); |
| 477 | + } |
| 478 | + scope.htmlSlides = currentSlides; |
| 479 | + } |
461 | 480 | } |
462 | 481 |
|
463 | 482 | if (iAttributes.rnCarouselControls!==undefined) { |
|
0 commit comments