I
I
IvanKalinin2015-06-23 02:21:52
JavaScript
IvanKalinin, 2015-06-23 02:21:52

How to change colspan when angularJS window width changes?

Tell me how to change colspan using angular?
controller:

$window.onresize = function(){
                $scope.colSpan = ($window.innerWidth <= 767) ? 4 : 6;
                console.log('colSpan');
                console.log($scope.colSpan);
            };

HTML:
<td colspan="{{colSpan}}" class="text-center">
In console $scope.colSpan changes value. It remains to understand what I missed, so that the value in the template changes.
UPD: this html is inside the directive

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IvanKalinin, 2015-06-23
@IvanKalinin

I provide a working solution

$window.onresize = function(attrs){
                $scope.colSpan = ($window.innerWidth <= 767) ? 4 : 6;
                $scope.$apply(attrs.confirmAction);
            };

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question