poniedziałek, 14 listopada 2016

How to list two [or more] entities in one view in Jhipster

I created new menu entry like this:

On new page - authorization.html I want to list two entities generated by JHipster:
  • productDelivered
  • category

I created /src/main/webapp/app/authorization/ folder. I copied there files from /src/main/webapp/app/entities/product-delivered/:
  • product-delivereds.html
  • product-delivered.state.js
  • product-delivered.service.js
  • product-delivered.controller.js

and changed their names from product-delivered to authorization and some instances of product-delivered inside of these files as well.

In authorization.controller.js added Category:

(function() {
    'use strict';

    angular
        .module('barfitterApp')
        .controller('AuthorizationController', AuthorizationController);

    AuthorizationController.$inject = ['$scope', '$state', 'Authorization', 'ProductDelivered', 'Category', 'ProductDeliveredSearch', 'ParseLinks', 'AlertService', 'pagingParams', 'paginationConstants'];

    function AuthorizationController ($scope, $state, Authorization, ProductDelivered, Category, ProductDeliveredSearch, ParseLinks, AlertService, pagingParams, paginationConstants) {

and:


vm.categories = [];
...

            Category.query(function(result) {
                vm.categories = result;
            });



and in authorization.html added at the bottom content from category.html




Brak komentarzy:

Prześlij komentarz