Nasuh Nasuh - 1 year ago 74
AngularJS Question

Dont show the $stateParams value in the link

I want to access the

value on my controller but I dont want to show the value on the links. Is this possible?


<a ui-sref="{name:, aktar: {chapter:card.chapter,}})">


.state('baba.series', {
url: "/series/:name/:aktar",
templateUrl: "states/baba.series.html",
controller: "nbgCtrl"

.controller('nbgCtrl', function ($scope, $stateParams) {
$scope.milo = $;

I am getting undefined.
Links should be look like
. Show the chapter value do not show the link value.

Edit: Output of $stateParams:

aktar:"[object Object]"

Answer Source

You can set data on the state, it will not be displayed on the URL when the state loads.

.state('baba.series', {
  url: "/series",
  templateUrl: "states/baba.series.html",
  controller: "nbgCtrl",
  data: {
    link: 'some value',
    isim: 'Value', 
    aktar: 'Value'

You can now retrieve the values from your controller

.controller('nbgCtrl', function ($scope, $state) {
  $scope.milo = $;
  $scope.isim = $;
  $scope.aktar = $;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download