Better angularjs code structure