Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

Empty result set #43

@vivendi

Description

@vivendi

How can I handle empty result sets? I'm using $resource to load my data with an Ajax call. When data is returned then it all works fine. But when I get no data, then the table keeps showing "Loading...".

I have HTML that looks like this:

<table datatable="ng" dt-options="dtOptions" class="row-border hover">
    <thead>
        <tr>
            <th>date (ISO)</th>
            <th>name</th>
            <th>email</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        <tr dt-rows="" ng-repeat="user in users">
            <td>{{ user.date }}</td>
            <td>{{ user.name }}</td>
            <td>{{ user.email }}</td>
            <td>actions</td>
        </tr>
    </tbody>
</table>

In my controller I have this:

// Init empty var
$scope.users = [];
//$scope.users = {}; Doesn't work either

I want to somehow init the table with an empty variable. But when I use a variable like that then it keeps saying "Loading...".

Is there a way to solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions