Grails AngularJs Profile

A profile for creating applications using AngularJS

Version: 1.1.1.BUILD-SNAPSHOT

Table of Contents

1 Introduction

Grails Profiles encapsulate project commands, templates and plugins. To create an application using the angularjs profile you can use the next command:

grails create-app myapp --profile=angularjs

Also, you could create a Grails application using the angularjs profile with the Grails Application Forge

start

Grails Application Forge is a great way to discover the different provided features in the profile.

2 Upgrade

You can explore the differences between Grails versions, to ease the upgrade of your Grails application created with the angularjs profile.

3 Profile Name

This profile was orginally named angular. In order to be consistent with the Angular team’s guidelines on naming conventions it was renamed to angularjs Read about the angular profiles name changes.

4 Plugins

If you create a Grails application with the angularjs profile you will see several dependencies included in build.gradle. Some of those are of special interest while developing AngularJS application with Grails.

In particular you will see a project and buildscript dependency to the Grails Angular Scaffolding Plugin. This plugin provides basic CRUD abilities using Angular in a single page application.

Read the Grails Angular Scaffolding blog post to see an example.

Additionally the project contains several dependencies worth mentioning:

Dependency

Description

com.craigburke.angular:angular-template-asset-pipeline

Allow our templates to be accessilbe client side

com.craigburke.angular:angular-annotate-asset-pipeline

Annotate our angular code for us.

com.craigburke:js-closure-wrap-asset-pipeline

Wrap each of our files in an inmediately invoked functional expression

com.craigburke.gradle:client-dependencies

Client Dependencies Gradle Plugin allows you to declare client side dependencies in build.gradle. You will find client side depedencies declared in build.gradle from npm.

5 Date Data Binding

The scaffolding relies on the default format Angular applies to dates when they are included in a request. In Grails 3.1.x and later, the date format is not included in the default list of date formats that databinding will attempt to use. You can easily add it yourself via configuration.

grails-app/conf/application.yml
grails:
     databinding:
         dateFormats:
             - "yyyy-MM-dd'T'HH:mm:ss.SSSX"

6 Guides, Quickcast and Blog Posts

To learn more about the AngularJS profiles, check the following Grails Guides & Quickcasts:

The following blog posts would be useful too:

7 Profile Info

You can always get information about the provided command and available features executing grails profile-info angularjs

You will see an output similar to:

Profile: angularjs
--------------------
A profile for creating applications using AngularJS

Provided Commands:
--------------------
* help - Prints help information for a specific command
* open - Opens a file in the project
* gradle - Allows running of Gradle tasks
* create-controller - Creates a controller
* create-domain-resource - Creates a domain class that represents a resource
* create-functional-test - Creates an functional test
* create-integration-test - Creates an integration test
* create-interceptor - Creates an interceptor
* create-restful-controller - Creates a REST controller
* clean - Cleans a Grails application's compiled sources
* compile - Compiles a Grails application
* create-command - Creates an Application Command
* create-domain-class - Creates a Domain Class
* create-service - Creates a Service
* create-unit-test - Creates a unit test
* install - Installs a Grails application or plugin into the local Maven cache
* assemble - Creates a JAR or WAR archive for production deployment
* bug-report - Creates a zip file that can be attached to issue reports for the current project
* console - Runs the Grails interactive console
* create-script - Creates a Grails script
* dependency-report - Prints out the Grails application's dependencies
* list-plugins - Lists available plugins from the Plugin Repository
* plugin-info - Prints information about the given plugin
* run-app - Runs a Grails application
* run-command - Executes Grails commands
* run-script - Executes Groovy scripts in a Grails context
* shell - Runs the Grails interactive shell
* stats - Prints statistics about the project
* stop-app - Stops the running Grails application
* test-app - Runs the applications tests
* generate-all - Generates a controller that performs REST operations
* generate-controller - Generates a controller that performs REST operations
* generate-functional-test - Generates a functional test for a controller that performs REST operations
* generate-unit-test - Generates a unit test for a controller that performs REST operations
* generate-views - Generates a controller that performs REST operations
* create-ng-component - Creates an Angular directive
* create-ng-controller - Creates an Angular controller
* create-ng-directive - Creates an Angular directive
* create-ng-domain - Creates an Angular domain
* create-ng-module - Creates an Angular module
* create-ng-service - Creates an Angular service

Provided Features:
--------------------
* security - Adds Spring Security REST to the project
* asset-pipeline - Adds Asset Pipeline to a Grails project
* events - Adds support for the Grails EventBus abstraction
* gsp - Adds support for GSP to the project
* hibernate4 - Adds GORM for Hibernate 4 to the project
* hibernate5 - Adds GORM for Hibernate 5 to the project
* json-views - Adds support for JSON Views to the project
* less-asset-pipeline - Adds LESS Transpiler Asset Pipeline to a Grails project
* markup-views - Adds support for Markup Views to the project
* mongodb - Adds GORM for MongoDB to the project
* neo4j - Adds GORM for Neo4j to the project
* rx-mongodb - Adds RxGORM for MongoDB to the project