小编Ant*_*n I的帖子

如何在$ routeProvider中将变量传递给$ scope

我需要在$ routeProvider中将变量传递给$ scope.代码如下:

.when('/:zone/edit/:id', {
      templateUrl: 'views/edit.html',
      controller: 'EditSet'
    })
    .when('/articles/edit/:id', {
      templateUrl: 'views/edit-article.html',
      controller: 'EditSet',
      params: {zone: 'articles'}
    })
Run Code Online (Sandbox Code Playgroud)

为了得到我使用的参数$scope.params.zone,它在第一种情况下起作用(:zone),在第二种情况下不起作用.

在这种情况下我该怎么办?

angularjs angularjs-scope

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

angularjs ×1

angularjs-scope ×1