angularjs check if array is empty in controller