Based on references and examples found under ngSanitize module included in angular-sanitize.js, the ideal way to parse input into properly escaped html string, is by using $sanitize component. Ex:
var accountName = $sanitize( $scope.accountName );
For this, it is required to include ngSanitize in the angular app module:
var myapp = angular.module('myapp',['ngSanitize']);
and included $sanitize in the controller where $sanitize is used:
myapp.controller('myctrl', [ "$scope", "$sanitize", function ( $scope, $sanitize) {
// code goes here
var accountName = $sanitize( $scope.accountName );
// further processing after sanitizing html input goes here
}
}]);
$sce is a service in angular that provides Strict Contextual Escaping, in which angular requires binding in certain contexts with values that are safe to be used. Further information can be found in angular documentation.