I use angular 1.3.19
There is a directive:
var directive = { controller: 'ProductsListController', restrict: 'A', template: ['<div class="filter-wraper">', '<div class="price-label"><span id="jprice-min">$0</span><span id="jprice-max">$5,000+</span></div>', '<input id="ex2" type="text" class="price-input" value="" data-slider-min="0" data-slider-max="5000" data-slider-step="1" data-slider-value="[0,5000]"/>', '</div>' ].join(''), link: function ($scope) { $scope.priceSliderInit = function (){ if ($(".catalog-page").length > 0) { $("#ex2").slider(); } } } };
It is necessary when changing the data-slider-value attribute in input to transfer the first value to span#jprice-min , and the second to span#jprice-max .
I tried to make another directive to input and then hang $observe via link , but when I try to refer to attr I get "attr. $ Observe is not a function".
Code of the second directive:
var directive = { restrict: 'A', link: function($scope, elem, attr){ attr.$observe('value', function(newValue){ console.log(newValue); }); } }; Tell me, please, can there be any other solutions to this issue?
ng-changeon the input and set variables in the handler that you then output instead of hard-coded values - Grundylinkfunction has fixed parameters: scope, element, attributes, controller - Grundy