0

how can we send to another page using like $state.go('/user/15') from controller is it possible in angularJs using ionic framework

Thank you.

2 Answers 2

1

Refer to ui-router specification : http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state

You'll see that $state.go has 2 optional parameters: - params - options

$stateProvider.state('login/:experience_id/:context', {
                url: '/login/:experience_id/:context',
                templateUrl: 'templates/login.html',
                controller: 'userController',
                data: {'context': 'login','experience_id':':experience_id'},

therefore, use thefollowing command :

$state.go('login/:experience_id/:context',{experience_id:myIdNumber,context:'login'});
Sign up to request clarification or add additional context in comments.

Comments

0

If you want to make a redirection :

You have to define a state in your app :

  .state('user', 
         {url: '/user',
          templateUrl: 'templates/user.html',
          controller: 'userCtrl'});

So you can now use the directive ui-sref="" like that:

<a ui-sref="user">Go in my templates/user.html</a>

This will make the redirection on the page user.html

Ref : http://learn.ionicframework.com/formulas/navigation-and-routing-part-2/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.