Base solution for your next web application
Open Closed

Angular State.Go not working #945


User avatar
0
teddylim created

Hi,

I am trying to do a similar thing like Change Text options under Language menu. However, the system seems ignoring the $State.go statement. I have managed to access the page by typing the URL manually on the browser (eg. <a class="postlink" href="http://localhost:6240/Application#/generalParams/Items/1">http://localhost:6240/Application#/gene ... ms/Items/1</a>). But, it cannot be accessed via the ng-click. I have debugged the index.js and managed to get to the $State.go statement but system just ignored it.

Below is a snapshot of the App.js and Index.js of the originating page. Please let me know if I'm missing any setup for the Angular routing. Thanks.

App.js

...
         if (abp.auth.hasPermission('Pages.Params.GeneralParams.Maintain')) {
             $stateProvider.state('parameterItems', {
                 url: '/generalParams/Items/:paramId',
                 templateUrl: '~/App/common/views/generalParams/Items.cshtml',
                 menu: 'Params.GeneralParams'
             });
         }
         ...

Index.js

...
         vm.maintainParamItems = function (paramHeader) {
             var paramIdString = paramHeader.id.toString();
             $state.go('parameterItems', {
                 paramId: paramIdString
             });
         }
         ...

2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You definition and call seems correct.

    Current user might not have required permission. Can you check by calling "$state.get()" in vm.maintainParamItems to see if "parameterItems" state is registered or not ?

  • User Avatar
    0
    teddylim created

    Hi,

    Sorry, please ignore this. I found the culprit.. I define '$stateParams' instead of '$state' at the top of index.js. Thanks.