Changed approach to use angular js with api controllers