Question

I followed this beautiful tutorial on using jhipster. I am able to run Maven and Grunt together. And I have been able to authenticate with the default user. Where I run into trouble is creating a new entity.

http://jhipster.github.io/creating_an_entity.html

I ran

    yo jhipster:entity foo

Then I made entries for the three foo js files in the index.html file after the angular javascript files:

    foo-router.js 
    foo-controller.js 
    foo-serrvice.js

The expected page does not appear on

    http://localhost:8080/#/foo

I see the following console errors:

    Uncaught ReferenceError: App is not defined foo-router.js:3
    (anonymous function) foo-router.js:3
    Uncaught ReferenceError: App is not defined foo-controller.js:3
    (anonymous function) foo-controller.js:3
    Uncaught ReferenceError: App is not defined foo-service.js:3
    (anonymous function) foo-service.js:3
Was it helpful?

Solution

Normally the name of your application should be read in your .yo-rc.json file (look at the root of your project), it's the "baseName" attribute in that file.

For example, if your application was named "test" when you first ran "yo jhipster", the entity sub-generator should take that name and create a "testApp" AngularJS application.

In your case, it looks like the application name was not read in the .yo-rc.json file: can you check what's inside that file?

OTHER TIPS

.yo-rc-.json the file Julien requested to see output on exists in the root of the project.

In your case, it looks like the application name was not read in the .yo-rc.json file: can you check what's inside that file? --Julien

{
   "generator-jhipster": {
   "packageName": "com.mycompany.myapp",
   "packageFolder": "com/mycompany/myapp",
   "hibernateCache": "ehcache"
}

I am happy with closing this issue, though Julien may want to add more to it. Essentially the yo entity generator

yo jhipster:entity foo

has a bug when I built using the default settings for the jhipster. Otherwise I may have misunderstood the directions but it does not look like that is the case.

My work around is to update the app name manually and make sure I referenced the foo javascript files after the app.js

Normally the your app name is defined in default controller file like your projectName+app. suppose your project name is demo then your app name is Demoapp which set by jhipster default.but when you create a new entity then it will not understand your app so it will set your app name in all foo file (foo-controller,foo-route,foo-service).

To solve this you can pick your app name for default controller file and replace it with "app" in foo-controller,foo-service and foo-route file.it will work fine for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top