angular已经用了一段时间了,最近在做路由,做一下笔记。

路由跳转的时候进行穿参 ui.router方式

<a ui-sref="edit({id:5})"> 编辑</a>
myapp.config(function($stateProvider, $urlRouterProvider){
    $stateProvider
        .state("edit", {
            url: "/edit/:id",
            templateUrl: "/admin/edit",
            controller:function($stateParams,$location){
                console.log($stateParams.id);
            }
        })
});

 还有一点,如果$stateParams取不到值,可以用$state试试

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2021-11-29
  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
猜你喜欢
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案