Angular 1 - get current URL parameters

前端 未结 6 1242
情话喂你
情话喂你 2020-11-30 03:37

I want to extract data from current URL and use it in controller. For example I have this url:

app.dev/backend/surveys/2

Bits t

6条回答
  •  悲&欢浪女
    2020-11-30 04:26

    ex: url/:id

    var sample= app.controller('sample', function ($scope, $routeParams) {
      $scope.init = function () {
        var qa_id = $routeParams.qa_id;
      }
    });
    

提交回复
热议问题