You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 21, 2025. It is now read-only.
I have chemical name C2H5OH which comes in
{{value.value}}where value = C2H5OH,
I used the function to replace the 2 and 5 with 2 and 5 with code
{{value.key == 'mol_formula' ? convertChemical(value.value) : value.value}}The function is-
$scope.convertChemical = function (chemicalName) { var newString = ''; for (i = 0; i < chemicalName.length; i++) { if (chemicalName[i].match(/[\d\.]+/g) != null) { newString += "<sub>" + chemicalName[i] + "</sub>"; } else { newString += chemicalName[i]; } } return newString; }In output I got the value like
C<sub>2</sub>H<sub>5</sub>OHbut I need it in Chemical format.
Like: C2H5OH
Please help