It doesn't work.

I have a dynamic array from the backend server. So I can't set a static 
number in totalItems?! I need the number of the list from the backend.. 
when I set $scope.totalItems.length then I have the dynamic number of 
items.. it is currently 12.. but in future the number of items can 
increment itself.

but the totalItems.length is NOT a INT.. I think it's a string. That is the 
problem why the list won't output correctly. Do you know what I mean?

The array consists of objects which have more items..

for example: {id: ..., firstname: ..., lastname: ... etc.} {....} and so on.

Am Freitag, 30. Januar 2015 17:16:52 UTC+1 schrieb Nicholas Smith:
>
> Sorry about that I forgot offset wasn't part of stock angular filters. 
>  You'll need to add it.  Here's a plnkr showing your code working with the 
> filter.
>
> http://plnkr.co/edit/QLH5beg2QMEVg9h5Fx2R?p=preview
>
> The filter to add will look like this:
>
> angular.module('YourAppModule').filter('offset', function () {
>   return function (input, offset) {
>     return (input instanceof Array) ? input.slice(+offset) : input; 
>   }
> })
>
>
>
>
> On Friday, January 30, 2015 at 10:07:46 AM UTC-6, Kristijan Pokas wrote:
>>
>> The problem is, that the $scope.list.length isn't an int value.
>>
>> I have to convert this but I don't know how..
>>
>> The items are coming from a backend server. There are object items.
>>
>> Am Freitag, 30. Januar 2015 16:58:20 UTC+1 schrieb Nicholas Smith:
>>>
>>> Does your $scope.list actually contain all the items not just one page 
>>> of results?  
>>>
>>>
>>> On Friday, January 30, 2015 at 9:55:36 AM UTC-6, Kristijan Pokas wrote:
>>>>
>>>> I've tried your solution but then it outputs no items. :(
>>>>
>>>> Am Freitag, 30. Januar 2015 16:23:14 UTC+1 schrieb Nicholas Smith:
>>>>>
>>>>> You need to specify an offset as a starting point in your ng-repeat 
>>>>> directive.
>>>>>
>>>>> <tr ng-repeat="model in list | offset: currentPage*itemsPerPage | 
>>>>> limitTo: itemsPerPage">
>>>>>
>>>>>
>>>>> On Friday, January 30, 2015 at 8:41:18 AM UTC-6, Kristijan Pokas wrote:
>>>>>>
>>>>>> $scope.totalItems = $scope.list;
>>>>>>
>>>>>> When I output my totalItems in the brackets {{totalItems.length}} 
>>>>>> then it outputs 12 (thats the currently number of items).
>>>>>>
>>>>>> I think the paginator see this as a string and not as a number, 
>>>>>> because when I'm giving my totalItems a static number then it outputs 
>>>>>> the 
>>>>>> correct Pagination Numbers (in my example there are 3 pages).
>>>>>>
>>>>>> How can I convert this in an Int value? I tried with parseInt but it 
>>>>>> doesn't work.
>>>>>>
>>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to