How access to list in angular object (getting by Java Rest)
<p>I use Jhipster for generate my code.</p>

<p>I have a class Calendar with list of Event.
I want to access to events list in my angular controller / view.
I can access to Object Calendar with query Java Rest.
But calendar.events is undifined, can't access directly to list.</p>

<p>How declare events list in controller ?</p>

<p><strong>Java Parts :</strong> 
Calendar.java</p>

<pre><code>@OneToMany(mappedBy = "calendar", cascade = { CascadeType.ALL }, orphanRemoval = true)
@JsonIgnore
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set&lt;Event&gt; events = new HashSet&lt;&gt;();
</code></pre>

<p>Event.java</p>

<pre><code>@ManyToOne
private Calendar calendar;
</code></pre>

<p>CalendarResource.java</p>

<pre><code>@RequestMapping(value = "/calendars/{id}",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@Transactional(propagation=Propagation.REQUIRED)
public ResponseEntity&lt;Calendar&gt; getCalendar(@PathVariable Long id) {
    log.debug("REST request to get Calendar : {}", id);
    Calendar calendar = calendarRepository.findOne(id);
    return Optional.ofNullable(calendar)
        .map(result -&gt; new ResponseEntity&lt;&gt;(
            result,
            HttpStatus.OK))
        .orElse(new ResponseEntity&lt;&gt;(HttpStatus.NOT_FOUND));
}

@RequestMapping(value = "/calendars",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@Transactional(propagation=Propagation.REQUIRED)
public ResponseEntity&lt;List&lt;Calendar&gt;&gt; getAllCalendars(Pageable pageable)
    throws URISyntaxException {
    log.debug("REST request to get a page of Calendars");
    Page&lt;Calendar&gt; page = calendarRepository.findAll(pageable); 
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/calendars");
    return new ResponseEntity&lt;&gt;(page.getContent(), headers, HttpStatus.OK);
}
</code></pre>

<p><strong>Angular Parts</strong>
calendar.service.js</p>

<pre><code>(function() {
'use strict';
angular
    .module('mandefaApp')
    .factory('Calendar', Calendar);

Calendar.$inject = ['$resource'];

function Calendar ($resource) {
    var resourceUrl =  'api/calendars/:id';

    return $resource(resourceUrl, {}, {
        'query': { method: 'GET', isArray: true},
        'get': {
            method: 'GET',
            transformResponse: function (data) {
                if (data) {
                    data = angular.fromJson(data);
                }
                return data;
            }
        },
        'update': { method:'PUT' }
    });
}
</code></pre>

<p>})();</p>

<p>calendar.controller.js</p>

<pre><code>(function() {
'use strict';

angular
    .module('mandefaApp')
    .controller('CalendarController', CalendarController);

CalendarController.$inject = ['$scope', '$state', 'Calendar', 'CalendarSearch', 'ParseLinks', 'AlertService', 'pagingParams', 'paginationConstants'];

function CalendarController ($scope, $state, Calendar, CalendarSearch, ParseLinks, AlertService, pagingParams, paginationConstants) {
    var vm = this;

    vm.loadPage = loadPage;
    vm.predicate = pagingParams.predicate;
    vm.reverse = pagingParams.ascending;
    vm.transition = transition;
    vm.itemsPerPage = paginationConstants.itemsPerPage;
    vm.clear = clear;
    vm.search = search;
    vm.loadAll = loadAll;
    vm.searchQuery = pagingParams.search;
    vm.currentSearch = pagingParams.search;

    loadAll();

    function loadAll () {
        if (pagingParams.search) {
            CalendarSearch.query({
                query: pagingParams.search,
                page: pagingParams.page - 1,
                size: vm.itemsPerPage,
                sort: sort()
            }, onSuccess, onError);
        } else {
            Calendar.query({
                page: pagingParams.page - 1,
                size: vm.itemsPerPage,
                sort: sort()
            }, onSuccess, onError);
        }
        function sort() {
            var result = [vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc')];
            if (vm.predicate !== 'id') {
                result.push('id');
            }
            return result;
        }
        function onSuccess(data, headers) {
            vm.links = ParseLinks.parse(headers('link'));
            vm.totalItems = headers('X-Total-Count');
            vm.queryCount = vm.totalItems;
            vm.calendars = data;
            vm.page = pagingParams.page;
        }
        function onError(error) {
            AlertService.error(error.data.message);
        }
    }

    function loadPage (page) {
        vm.page = page;
        vm.transition();
    }

    function transition () {
        $state.transitionTo($state.$current, {
            page: vm.page,
            sort: vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc'),
            search: vm.currentSearch
        });
    }

    function search (searchQuery) {
        if (!searchQuery){
            return vm.clear();
        }
        vm.links = null;
        vm.page = 1;
        vm.predicate = '_score';
        vm.reverse = false;
        vm.currentSearch = searchQuery;
        vm.transition();
    }

    function clear () {
        vm.links = null;
        vm.page = 1;
        vm.predicate = 'id';
        vm.reverse = true;
        vm.currentSearch = null;
        vm.transition();
    }
}
</code></pre>

<p>})();</p>

<p><strong>Html Code :</strong> </p>

<pre><code>&lt;div class="table-responsive"&gt;
    &lt;table class="jh-table table table-striped"&gt;
        &lt;thead&gt;
            &lt;tr jh-sort="vm.predicate" ascending="vm.reverse" callback="vm.transition()"&gt;
                &lt;th jh-sort-by="id"&gt;&lt;span translate="global.field.id"&gt;ID&lt;/span&gt; &lt;span class="glyphicon glyphicon-sort"&gt;&lt;/span&gt;&lt;/th&gt;
                &lt;th jh-sort-by="title"&gt;&lt;span translate="mandefaApp.calendar.title"&gt;Title&lt;/span&gt; &lt;span class="glyphicon glyphicon-sort"&gt;&lt;/span&gt;&lt;/th&gt;
                &lt;th jh-sort-by="title"&gt;Event Size &lt;span class="glyphicon glyphicon-sort"&gt;&lt;/span&gt;&lt;/th&gt;
            &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
            &lt;tr ng-repeat="calendar in vm.calendars track by calendar.id"&gt;
                &lt;td&gt;&lt;a ui-sref="calendar-detail({id:calendar.id})"&gt;{{calendar.id}}&lt;/a&gt;&lt;/td&gt;
                &lt;td&gt;{{calendar.title}}&lt;/td&gt;
                &lt;td&gt;{{calendar.events.lenght}}&lt;/td&gt; &lt;!-- How can access to events in calendar object ? --&gt;
            &lt;/tr&gt;
        &lt;/tbody&gt;
    &lt;/table&gt;
&lt;/div&gt;
</code></pre>