1

Hi I'm writing a WebApp using python, turbogears 2.2, and Genshi for my view\templates.

On the view side, I'm also using Angular.js. most of the time it they work together. My problem is – when I want to use some stuff like $index inside an ng-repeat I cannot. When I try doing that, I get a genshi.template.eval.UndefinedError

here is some html code to demonstrate:

  <html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:py="http://genshi.edgewall.org/"
  xmlns:xi="http://www.w3.org/2001/XInclude" ng-app="orderItemEditApp">

... some code ...

<tr ngrepeat="item in items">
    <td>{{$index}}</td>

....

Is there a way to use $index (or other stuff) with genshi and angular.js? Thanks for the help

A-Palgy
  • 1,291
  • 2
  • 14
  • 30

1 Answers1

2

Use double dollar signs in your Genshi template for escaping:

<td>{{$$index}}</td>

Will output:

<td>{{$index}}</td>
tasseKATT
  • 38,470
  • 8
  • 84
  • 65
  • Thanks, I didnt think about escaping. [Escaping in Genshi](http://genshi.edgewall.org/wiki/Documentation/templates.html#escaping) – A-Palgy Nov 20 '14 at 11:03
  • 1
    There is also a short example of Angular with TG on TG documentation that explains that and how to properly load Resources from TGRestController: http://turbogears.readthedocs.org/en/latest/cookbook/Crud/restapi.html#leveraging-your-rest-api-on-angularjs – amol Nov 20 '14 at 18:56