javascript - AngularJS Redirecting after displaying the parameter -


this continuation of my question

so far didn't url value. can able url paameter problem page getting redirected once showing alert

here controller , route

route

.when('/showprofile/:userid', {   templateurl: 'resources/views/layout/showprofile.php',     controller: 'showuserctrl'       }) 

controller ;

app.controller('showuserctrl', function($scope, $routeparams) {  var b = $routeparams.userid;  alert(b);     $scope.userid = $routeparams.userid; }); 

my view :

{{userid}} 

the problem url this

http://192.168.1.58/myapp/#/showprofile/18

after showing alert 18

it makes url

http://192.168.1.58/myapp/#/showprofile/:userid

how can stop redirection .. ??

i want final url

http://192.168.1.58/myapp/#/showprofile/18

i found problem because of .run function have.

after removing works good.

here .run function

.run(function ($rootscope, $location, data, $http) {             $rootscope.$on("$routechangestart", function (event, next, current) {                 $http.post('checksession', {}).then(function (results)                 {                     console.log(results.data);                     var nexturl = next.$$route.originalpath;                     if (nexturl == '/signin' || nexturl == '/login' || nexturl == '/verify' || nexturl == '/registration' || nexturl == '/forget' || nexturl == '/invalidtoken' || nexturl == '/registersuccess')                     {                         console.log('outpages');                     }                     else                     {                         if (results.data == 1)                         {                             console.log('loggedin');                             console.log(nexturl);                             console.log('to redirect');                             $location.path(nexturl);                         }                         else {                             console.log('not logged in');                             $location.path('login');                         }                     }                   });             });         }); 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -