-1
我我有一个引导的HTML页面,我想改变的东西时,COL-MD-8变化COL-SM-8在#image-wrapper
的股利。所以我有o nClassChange Directive
,当我的UI组件类将col-md-8更改为col-sm-8时,我想从我的控制器调用reTroop
方法。但我无法从我的指令中识别引导程序类更改的变化。 当我比较旧类和新类时,它们都具有相同的值。我怎么能知道通过AngularJS引导活动类的改变指令
<div id="image-block" on-class-change update-fn="reTroop(className)" class="col-md-8 col-sm-8 col xs-12 ">
</div>
她是我的控制器:
$scope.reTroop = function (className) {
console.log("RETROOP !!", className)
};
这里是我的指令
app.directive('onClassChange', function() {
return {
scope: {updateCtrlFn: '&updateFn'},
link: function (scope, element, attrs) {
scope.$watch(function() {
return element.attr('class');
}, function (newValue, oldValue) {
console.log("newValue", newValue);
console.log("oldValue", oldValue);
scope.updateCtrlFn({className: element.attr('class')});
}
);
}
}
;
})
他们都正常工作,只是我没有找到,怎么能根据我的窗口大小,我确认当前哪个类是活动的。
谢谢!我需要提高自己的引导知识 – oguzhan00