Angular - method in controller