The problem is definitely with jquery 1.9.1
HTML strings with leading whitespace: jQuery 1.9 restricts the strings processed by $() for security reasons. Although we recommend you use $.parseHTML() to process arbitrary HTML like templates, the 1.1.0 version of the Migrate plugin restores the old behavior.
way to deal with it is use any kind of trimming function, whether it's jquery's $.trim or underscores trim or even your own.
Note that this problem only occurs when trying to use template from $templateCache, if you use template or templateUrl attr on the directive it works fine, I guess angular internally trims it.