vineesh
vineesh

Reputation: 71

How to navigate from one entity page to another entity page in jhipster

Hi i have created j hipster application with client-side framework is angular 1.x with spring boot and created two entities called Home and Customer when i create new Home entity and save it will show home entity but how can i navigate Customer page when saving my Home entity.

Upvotes: 0

Views: 386

Answers (1)

David Steiman
David Steiman

Reputation: 3145

first, you open src/main/webapp/app/entities/home/home.controller.js

and add $router to the controllers injection block

(function() {
    'use strict';

    angular
        .module('yourapp')
        .controller('HomeController', HomeController);

    HomeController.$inject = ['$scope','$state', /* add router here */ '$router'];

    function HomeController ($scope, $state, /* add router here */ $router) {
        var vm = this;
        //...

and than you are able to navigate your route, by proving your targets state name to $router.go('state')

in your case: $router.go('customer') in the save function

Upvotes: 2

Related Questions