Use factory in angular