I have an Ember component called alert-message
which returns a more user-friendly error message for validation purposes. One of the error messages contains an ID (which I've hardcoded here)- I'd like to turn the ID into a hyperlink and display it in the message.
I understand using the str.link() method simply creates a string representing the code for an HTML link element.
What I currently have renders this: "Cannot update this item with <a href="/items/31010-2001-20311">31010-2001-20311</a>."
How do I turn the generated html into an actual link?
In my component template I render:
import Ember from 'ember';
export default Ember.Component.extend({
errorMessage: function () {
const status = this.getWithDefault('status', '');
if (status === '409') {
var id = 31010-2001-20311;
var idLink = id.link('/items/31010-2001-20311');
return `Cannot update this item with ${idLink}.`;
}
{
return status;
}
}.property('status')
});
Aucun commentaire:
Enregistrer un commentaire