Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

is there any way to add new dynamic pages on Ionic Framework?

Can I edit in some way $stateProvider adding new pages from a controller?

$stateProvider
    .state('loading', {
       name: 'newpage' + dyn, 
       url: '/newpage' + dyn, 
       templateUrl: 'thisisfixed.html', 
       controller: 'PageCtrl',
     })

Thanks, Claudio

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It is possible, but ... It could behave a bit differently then you expect. Because the url will be defined after configuration phase, it won't be working on Refresh (F5) or when such URL is passed to other user. Simply, what is not ready in config phase - is not available directly.

But - if that should work only inside of the application, you can do it like this:

var $stateProviderRef;

angular
  .module(...)
  .config(['$stateProvider', function($stateProvider){
    $stateProviderRef = $stateProvider;
  }])

And you can later assing more states... using $stateProviderRef

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.