Reputation: 1888
I have an Angular.js application that I want to start using Haml with. My problem is some of my code doesn't convert properly.
I need to output the following:
<form name='userForm' class='admin-form form-horizontal' ng-submit='userForm.$valid && saveUser()' novalidate></form>
So in Haml, I write:
%form{:class => 'admin-form form-horizontal', :name => 'userForm', :'ng-submit'=>'userForm.$valid && saveUser()'}
The problem though is that the &&
gets converted to &&
so:
<form name='userForm' class='admin-form form-horizontal' ng-submit='userForm.$valid && saveUser()' novalidate></form>
What can I do to prevent this? Also, is it possible to put each attribute of a tag in Haml on a separate line? I get errors when I try to do that as well.
Upvotes: 3
Views: 462
Reputation: 1888
Alright, I got it to work by setting no-escape-attrs
to true
in the Gruntfile haml options:
haml:
options:
'no-escape-attrs': true
Upvotes: 1
Reputation: 79783
You need to set the escape_attrs
option to false. How you do this will depend on how you are using Haml, see the docs.
e.g. from the command line:
$haml --no-escape-attrs
%form{:class => 'admin-form form-horizontal', :name => 'userForm', :'ng-submit'=>'userForm.$valid && saveUser()'}
produces:
<form class='admin-form form-horizontal' name='userForm' ng-submit='userForm.$valid && saveUser()'></form>
Upvotes: 1