switch from core javascipt to angular javascript