same thing using promises

Using angular promises ($q -- take a look at the documentation https://docs.angularjs.org/api/ng/service/$q) to populate profiles list.