Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Disable SanitizeValueStrategy for one $translate call #1297

Closed
guillaume-fr opened this issue Nov 17, 2015 · 3 comments
Closed

Disable SanitizeValueStrategy for one $translate call #1297

guillaume-fr opened this issue Nov 17, 2015 · 3 comments

Comments

@guillaume-fr
Copy link

I configured translateProvider with 'sanitize' strategy and want to keep it to prevent injection.

There is a chart in my application draw using a canvas, I want to disable (or change) the SanitizeValueStrategy when I call $translate() to retrieve text (series names) that will be written on the canvas.

I don't know if this is already possible, otherwise it could be great to have a parameter for SanitizeStrategy or a dedicated function like $translate.unsafe() ignoring sanitize.

@mwz
Copy link

mwz commented Dec 4, 2015

Having $translate.instant() accepting a null sanitization strategy would be useful, alternatively calling $translateSanitization.sanitize(value, mode, "null") would also work for me.

I've been using the following as a workaround:

$translateSanitization.useStrategy(null);
var translation = $translate.instant('KEY');
$translateSanitization.useStrategy('escape');

@RenaldasK
Copy link

+1 Having same issue

@knalli
Copy link
Member

knalli commented Dec 13, 2015

Ok. I have tagged this as "Contribution Welcome". (hint-hint).

spiroid added a commit to spiroid/angular-translate that referenced this issue Jul 27, 2016
Sometimes non html messages need to be translated. For example in
notification popups, etc.
The only solution as for now, was to the disable sanitize strategy globally.
This modification add a sanitizeStrategy parameter to the
$translate.instant function to allow to override this only for one call.

Relates angular-translate#1297
spiroid added a commit to spiroid/angular-translate that referenced this issue Jul 28, 2016
Sometimes non html messages need to be translated. For example in
notification popups, etc.
The only solution as for now, was to the disable sanitize strategy globally.
This modification add a sanitizeStrategy parameter to the
$translate.instant function to allow to override this only for one call.

Relates angular-translate#1297
spiroid added a commit to spiroid/angular-translate that referenced this issue Jul 28, 2016
Sometimes non html messages need to be translated. For example in
notification popups, etc.
The only solution as for now, was to the disable sanitize strategy globally.
This modification add a sanitizeStrategy parameter to the
$translate.instant function to allow to override this only for one call.

Relates angular-translate#1297
spiroid added a commit to spiroid/angular-translate that referenced this issue Jul 28, 2016
Sometimes non html messages need to be translated. For example in
notification popups, etc.
The only solution as for now, was to the disable sanitize strategy globally.
This modification add a sanitizeStrategy parameter to the
$translate.instant function to allow to override this only for one call.

Relates angular-translate#1297
spiroid added a commit to spiroid/angular-translate that referenced this issue Sep 22, 2016
Sometimes non html messages need to be translated. For example in
notification popups, etc.
The only solution as for now, was to the disable sanitize strategy globally.
This modification add a sanitizeStrategy parameter to the
$translate.instant function to allow to override this only for one call.

Relates angular-translate#1297
@knalli knalli closed this as completed Feb 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants