Create a New Module with The Help Of AngularJs in Grails.
In this blog I am going to explain how to create dynamic email template using Groovy and AngularJs. Grails uses GSP (Grails server pages) pages to create email templates which have static content. But here we want to add dynamic contents where user will be able to create, edit, delete template accordingly. In this blog, I will create a dummy project to create dynamic template module through the Angularjs in grails.
Step1: Here this link will open a email template module.
Step2: Create a new JS file in Any Folder of the project.
Step4: Import Controller and Service in App.js
Step5: Create Html Page for the module.
Step7: Create Service to get the data from the Database.
Ex-emailService.js and import in Main Js file.
* To crerate a dummy API's for crud operations:-
Step8: Goto Service and define all the API's are as follow:-
The factory function creates a single object or function that represents the service to the rest of the application. This Service has to import in controllers.
Step9: In emailTmeplate.js
//Save Function (temp contains all the inputs which comes from the User)