任何人都可以建议使用angular-route模块将数据发送到路由视图的最佳方法是什么。
我尝试使用解析块,但是在我的项目中有500条路由配置,并且由于需要传递类似类型的数据,因此,如果我们可以使用一些通用的解析块或其他逻辑来做,那会更好将数据传递到路由视图,而不是修改500条路由并重复添加相同的逻辑。
我尝试在resolve块中传递值,但这将意味着修改所有500条路由的路由配置
// route configuration for adding resolve block
$routeProvider.when('/classes/:classId', {
controller: 'ClassCtrl',
templateUrl: TEMPLATE_CACHE + '/classByStudent.html',
reloadOnSearch: false,
resolve: {
data: 'some_value'
}
})