As Sasxa was saying, declare a scope variable like "myScopeVar" or "someValue"
JS - in your controller
$scope.numDisp = 6;
// based on screen width, but you can base on height as well http://www.w3schools.com/js/js_window_screen.asp
if(window.screen.width < 641)
$scope.numDisp = 6; //
else if(window.screen.width > 640 && window.screen.width < 1025)
$scope.numDisp = 15
else if(window.screen.width > 1024)
$scope.numDisp = 20
HTML:
.article(ng-repeat="article in articles | limitTo: numDisp", class='item-{{ $index + 1 }}')
Update
I looked at your plunker and noticed that you should be firing the screen width check inside your directive.
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.items = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10
];
$scope.numDisp = 3;
});
app.directive('resizable', function($window) {
return function($scope) {
$scope.initializeWindowSize = function() {
$scope.windowHeight = $window.innerHeight;
// do width check here, especially since you have $window object here already
if($window.innerWidth < 641)
$scope.numDisp = 3; //
else if($window.innerWidth > 640 && $window.innerWidth < 1025)
$scope.numDisp = 5;
else if($window.innerWidth > 1024)
$scope.numDisp = 10;
console.log($window.innerWidth, $scope.numDisp); // check console for right output
return $scope.windowWidth = $window.innerWidth;
};
$scope.initializeWindowSize();
return angular.element($window).bind('resize', function() {
$scope.initializeWindowSize();
return $scope.$apply();
});
};
});