在AngularJS中隐藏URL参数

时间:2017-03-30 07:12:20

标签: angularjs anchor

我对AngularJS很新。 我的问题是关于在URL中隐藏参数。

例如,我有一个URL Like,

http://localhost:8080/CareerTurn/#/viewExamwiseStudentsReport?exam_id=2&eName=College%20Model%20Exam&mMarks=10&time=00:10

我想表明这一点,

http://localhost:8080/CareerTurn/#/viewExamwiseStudentsReport

HTML:

<a href="#viewExamwiseStudentsReport?exam_id={{exa.model_exam_id}}&eName={{exa.model_exam_name}}&mMarks={{exa.model_exam_total_marks}}&time={{exa.model_exam_duration}}">

我不想在URL中显示参数,但我想在我的JS控制器中使用它们,

如何实现呢?

1 个答案:

答案 0 :(得分:0)

您可以使用

$location.url($location.path());

另外

如果要删除所有查询参数,请执行以下操作:

$location.search({});

如果要删除一个特定查询参数,请执行:

$location.search('ParamName', null);
相关问题