switched from vanilla js to angularjs