getting value in angularjs and quotemark

291 views Asked by At

I have some project written by someone else using AngularJS and i have to do small changes in it.

There are forms, where user can insert their own text, and it is then displayed on page. But as far, as i can see, it's not save. For example, here is fragment of TPL displaying images:

<img src="{$category->iconUrl}" alt="{$category->name}" title="{$category->name}">

Everything works fine, until user will input quote mark in category name.

is there any way to add something like php "addslashes"? in easy way?

So far we've spend with 3 coworkers 6 hours each on so simple task and we all already hate AngularJS :) But work must be done.

1

There are 1 answers

3
wroniasty On

It lookes like the category name is inserted in PHP rather than by AngularJS.

If it is Smarty, then the correct syntax would be:

<img src="{$category->iconUrl}" alt="{$category->name}" 
     title="{$category->name|escape}">