If you manage to link your components to a certain model you could use an hash function over that model... an hash function like this (Taken from an answer from this question Simple (non-secure) hash function for JavaScript? and transformed it as a simple function):
hashObject(o: any) {
var l = 2;
var i, c, r = [];
for (i = 0; i < l; i++)
r.push(i * 268803292);
function stringify(o) {
var i, r;
if (o === null) return "n";
if (o === true) return "t";
if (o === false) return "f";
if (o instanceof Date) return "d:" + o.toString();
i = typeof o;
if (i === "string") return "s:" + o.replace(/([\\\\;])/g, "\\$1");
if (i === "number") return "n:" + o;
if (o instanceof Function) return "m:" + o.toString().replace(/([\\\\;])/g, "\\$1");
if (o instanceof Array) {
r = [];
for (i = 0; i < o.length; i++)
r.push(stringify(o[i]));
return "a:" + r.join(";");
}
r = [];
for (i in o) {
r.push(i + ":" + stringify(o[i]));
}
return "o:" + r.join(";");
}
o = stringify(o);
for (i = 0; i < o.length; i++) {
for (c = 0; c < r.length; c++) {
r[c] = (r[c] << 13) - (r[c] >> 19);
r[c] += o.charCodeAt(i) << (r[c] % 24);
r[c] = r[c] & r[c];
}
}
for (i = 0; i < r.length; i++) {
r[i] = this.toHex(r[i]);
}
return r.join("");
}
toHex(number: number): string {
var ret = ((number < 0 ? 0x8 : 0) + ((number >> 28) & 0x7)).toString(16) + (number & 0xfffffff).toString(16);
while (ret.length < 8) ret = "0" + ret;
return ret;
}
Or, if you really just need to generate test ids you could use faker.js (https://github.com/marak/Faker.js/). By providing a seed to its data generator you can obtain deterministic results