Converting Ampersand with Haml with Angular.js app
I have an Angular.js app that I want to start using Haml with. My problem is that some of my codes are not converting correctly.
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 is what &&
gets converted to &&
like this:
<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 tag attribute in Haml on a separate line? I am getting errors when I try to do this.
+3
source to share
2 answers
You need to set the value escape_attrs
to false. How you do this will depend on how you use Haml to see the docs .
eg. from the command line:
$haml --no-escape-attrs %form{:class => 'admin-form form-horizontal', :name => 'userForm', :'ng-submit'=>'userForm.$valid && saveUser()'}
gives:
<form class='admin-form form-horizontal' name='userForm' ng-submit='userForm.$valid && saveUser()'></form>
+1
source to share