On Friday, September 28, 2012 12:31:26 PM UTC-4, Derek wrote:
>
> Have you ever tried using AngularJS with Web2py? It's a mess because all 
> the instructions I tried didn't work.
> You can't use their templates at all, you have to do this:
> <span ng:bind="item.name"></span> 
>
> instead of the much easier {{item.name}}
>

You can use Angular's template delimiters if you're willing to switch to 
different delimiters for web2py. In web2py, just do something like:

response.delimiters = ['{%', '%}']

or whatever delimiters you want to use. It's also possible to create a 
helper that you can use in web2py views that would output Angular 
delimiters:

class ng(DIV):
    tag = ''
    def xml(self):
        return '{{%s}}' % super(ng, self).xml()

Then in a web2py view:

{{=ng('item.name')}}

would produce HTML with the following content:

{{item.name}}

Anthony

-- 



Reply via email to