1

How do I configure a grails2.4 application (asset pipeline) with Angular js. (without using any plugins)

So far, this is what I have and it doesnt seem to work.

I put angular.min.js in the folder grails-app/assets/javascripts and I did this in the gsp

`<asset:javascript src="angular.min.js" />
<asset:javascript src="ui-bootstrap-tpls-0.9.0.min.js" />` 

and

`<html ng-app="VTPaceApp" novalidate>` 

when I did this {{ "Your's," + " truly" }}, I dont see any angular effect.
I've also tried putting //= require /angular/angular in application.js and that did not work either.

Thanks.

ErasmoOliveira
  • 1,416
  • 2
  • 20
  • 40
ThePearl
  • 151
  • 2
  • 14
  • where is your `VTPaceApp` function defined? – Claies Feb 19 '15 at 12:31
  • in main.js `(function() { var app = angular.module('VTPaceApp', ['ui.bootstrap']);` and I included main.js like this `` – ThePearl Feb 19 '15 at 14:01
  • ok, that looks correct; so what are you seeing when you load the page? and are you getting any errors in the browser debug console? also, please update your question with code elements, they are impossible to read in comments. – Claies Feb 19 '15 at 14:56
  • Sorry about that. I dont see any errors on the debug console. Except for a warning. `WARNING: Tried to load angular more than once.` – ThePearl Feb 19 '15 at 15:14
  • hmm, tried to load angular more than once? that tells me there is something not right with the scripts and the load order; I think we need to see a more complete picture of the HTML and JavaScript you are working with here. – Claies Feb 19 '15 at 17:14

1 Answers1

0

I got it to working. Followed this blog, so, basically, did bower install angular
add these directives to application.js
//= require angular/angular //= require_tree views
add <asset:javascript src="application.js"/> to gsp

Test using the following code in your gsp
<div ng-app=""> <p>My first expression: {{ 5 + 5 }}</p> <p> {{"Your are " + " welcome"}}</p> </div>

ThePearl
  • 151
  • 2
  • 14