pythonhtmlangularjsturbogears2genshi

Angular.js and Genshi - conflicts using $


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


Solution

  • Use double dollar signs in your Genshi template for escaping:

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

    Will output:

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