There's always divide and conquer:
function appropriateNameHere(stateHelperProvider) {
var contacts, products, state;
contacts = {
name: 'contacts',
templateUrl: 'contacts.html',
children: [{
name: 'list',
templateUrl: 'contacts.list.html'
}]
};
products = {
name: 'products',
templateUrl: 'products.html',
children: [{
name: 'list',
templateUrl: 'products.list.html'
}]
};
state = {
name: 'root',
templateUrl: 'root.html',
children: [contacts, products]
};
stateHelperProvider.setNestedState(state);
}
angular.module(
'myApp',
['ui.router', 'ui.router.stateHelper']
).config(appropriateNameHere);
Where you draw the line there is almost totally subjective/opinion-based. Some people will be just fine with your code as-is, others will feel it needs to be made more granular than I did above. But that's the fundamental technique you'd use when applying your opinion. :-)