How can i add arbritrary attributesto dom objects in the cli?

in ionic-cli i cannot just do

div.myProperty = “Hello”;

its works in normal html page with ionic script imports of course …

anyone got a solution ?


x.setAttribute("_name", customer );



i cannot

customersList.onclick = function (e) {



the would be one of the ion-items (or just a div) in the list

getAttribute doesnt work on either


shit, doesnt work either… i cannot set any attribute … is null … ohh man whyi always have to struggle for hours on such shit


and for android it doesnt even build …


x.setAttribute(“y”, “hello”)

this only works on normal HTML elements like div , not on ion-items, so just append a div to your ionic element to store arbritrary data corresponding to a list item or whatever

to get it back through

( as HTMLElement).children[0].getAttribute(“y”)

then no need to count through lists and compare them to arrays, other wise you could only use the .id slot to set a reference point … this is easier when you have no need for complex angular models