【发布时间】:2014-05-14 08:08:26
【问题描述】:
以下代码示例(取自 AngularJS ui-router wiki)说明了我的问题。
angular.module('myApp', ['ui.router', 'ui.router.stateHelper'])
.config(function(stateHelperProvider){
stateHelperProvider.setNestedState({
name: 'root',
templateUrl: 'root.html',
children: [
{
name: 'contacts',
templateUrl: 'contacts.html',
children: [
{
name: 'list',
templateUrl: 'contacts.list.html'
}
]
},
{
name: 'products',
templateUrl: 'products.html',
children: [
{
name: 'list',
templateUrl: 'products.list.html'
}
]
}
]
});
});
具体来说,这些行:
}
]
}
]
});
});
我觉得这很丑。有没有办法避免这些?
注意:我意识到 CoffeeScript 可以提供一些帮助,但我主要对 Javascript 可以做什么感兴趣。
【问题讨论】: