gpt4 book ai didi

javascript - 在 Angular 中,如何从指令中获取元素的宽度?

转载 作者:行者123 更新时间:2023-11-29 21:55:22 31 4
gpt4 key购买 nike

如何从该指令中获取 el 的宽度?

angular.module('carouselApp')
.directive('waProgress', ['Pages', 'Carousel', '$window', '$timeout', function(Pages, Carousel, $window, $timeout) {
return {
scope: {
pages: "="
},
templateUrl: 'views/wa.progress.html',
transclude: true,
require: '^waCarousel',
link: function(scope, el, attrs, ctrl) {
// console.log();
scope.progressed = false;
scope.$root.subscribe('updateCarousel', function(params){
// console.log('asdfasdf', params);
scope.progress = params;

scope.passedProgress = function(idx){
if(scope.progress.currentPage > idx){
console.log(el.width());
return scope.progressed = true;
// scope.animatedWidth = $
}
}
});
scope.futureProgress = function(idx) {
console.log(idx)
};
}
}
}]);

最佳答案

关于javascript - 在 Angular 中,如何从指令中获取元素的宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26684835/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com