Grails 3.2.9 with AngularJS 1.x CRUD Application



Create AngularJS application with Grails 3.2.9 in most easiest way. Just need 10 Minutes approx..

Step 1 :
mkdir testang3

cd testang3

grails -> (tab+enter)

grails> create-app --profile angularjs
| Application created at /home/ketan/AngularJS/testang3
| Resolving Dependencies. Please wait...

CONFIGURE SUCCESSFUL

Total time: 10.872 secs

grails> create-domain-resource Student
| Created grails-app/domain/testang3/Student.groovy
| Created src/test/groovy/testang3/StudentSpec.groovy

Step 2 :

Edit the Student.groovy under domain directory as :

package testang3
import grails.rest.*
@Resource(readOnly = false, formats = ['json', 'xml'])
class Student {
    String name    Integer age    String school}

Step 3 :


grails> ng-generate-all testang3.Student
:compileJava NO-SOURCE
:compileGroovy
:buildProperties
:processResources
:classes
:findMainClass
:ngGenerateAll
Warning | Destination file grails-app/assets/javascripts/testang3/core/testang3.core.js already exists, skipping...
grails-app/assets/javascripts/testang3/testang3.js
Added testang3.student as a dependency to testang3
Rendered template module.js to destination grails-app/assets/javascripts/testang3/student/testang3.student.js
Rendered template create.tpl.html to destination grails-app/assets/javascripts/testang3/student/templates/create.tpl.html
Rendered template edit.tpl.html to destination grails-app/assets/javascripts/testang3/student/templates/edit.tpl.html
Rendered template show.tpl.html to destination grails-app/assets/javascripts/testang3/student/templates/show.tpl.html
Rendered template list.tpl.html to destination grails-app/assets/javascripts/testang3/student/templates/list.tpl.html
Rendered template createController.js to destination grails-app/assets/javascripts/testang3/student/controllers/studentCreateController.js
Rendered template editController.js to destination grails-app/assets/javascripts/testang3/student/controllers/studentEditController.js
Rendered template listController.js to destination grails-app/assets/javascripts/testang3/student/controllers/studentListController.js
Rendered template showController.js to destination grails-app/assets/javascripts/testang3/student/controllers/studentShowController.js
Rendered template domain.js to destination grails-app/assets/javascripts/testang3/student/domain/Student.js

BUILD SUCCESSFUL

Total time: 46.837 secs
grails> run-app
| Running application...
Grails application running at http://localhost:8080 in environment: development


Enjoy your application with full CRUD operation.


I hope it will help you..

No comments:

Powered by Blogger.