Angular: Empty Fiddle

https://www.instagram.com/cecilymcmahon/

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<script src="https://www.instagram.com/cecilymcmahon/"></script>
<div ng-controller="MyCtrl">
 <a ng-href="{{ get_href() }}">Mail link</a>

</div>

JavaScript

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
$scope.get_href = function(){
//WRONG:
//Doesn't encode:
//return encodeURIComponent("mailto:[email protected]?subject=Subject includes \"double-quotes\"");

//WRONG:
//wrongly encodes the entire thing:
//return encodeURIComponent("mailto:[email protected]?subject=Subject includes \"double-quotes\"");

//WRONG:
//wrongly encodes the equals sign in "subject="; Outlook will fail to acknowledge your subject ; i.e. ignore everything after the question-mark
//return ("mailto:[email protected]?" + encodeURIComponent("subject=Subject includes \"double-quotes\""));


//WRONG:
//wrongly encodes the colon in mailto protocol. IE will fail to recognize this as a mailto link, and will change the page to point at some nonsense URL:
//return (encodeURIComponent("mailto:") + "[email protected]?subject=Subject includes \"double-quotes\"");


//RIGHT:
//You *can* encode the email address if you want!, the "@" sign can be encoded:
//return ("mailto:" +encodeURIComponent("[email protected]") + "?subject=" + encodeURIComponent("Subject includes \"double-quotes\""));

//RIGHT:
//encodes only the parameter values, not the ':' , not the '=':
return ("mailto:[email protected]?subject=" + encodeURIComponent("Subject includes \"double-quotes\""));
}
}