Fixed bug where backslash (\) would not be escaped in output

This can affect properties like ng-pattern.