0

Using angular 1.5, I'm developing some features and views, where I pretend to perform some navigation, keeping the url untouchable

example:

1) Access to url myapp.com, shows login form
2) login success (do stuff, doesnt matter now)
3) view changes with other content but url stays the same

Few examples i've seen by far, each view has diferent urls to perform the navigation

example:

login: url: myapp.com/login

1

2 Answers 2

1

You should use the states for this, having a 'home' state with a url, then other states but not declare urls:

.state('home', {
  url: "/home",
  templateUrl: "foobar.html",
  controller: function($scope) { 
    // Check your login here;
  }
})
.state('home.page-two', {
  url: "",
  templateUrl: "foobar-two.html",
  controller: function($scope) { }
})
.state('home.page-three', {
  url: "",
  templateUrl: "foobar-three.html",
  controller: function($scope) { }
})

Then to move between the states, use the $state.go() to load your particular state once you've made sure the login has been processed to your satisfaction.

Sign up to request clarification or add additional context in comments.

Comments

0

you will not be able to use the angular "views" for this, because those are bound to different urls. what you can do is implement your own "view-system" using ng-show, ng-if and ng-include.

3 Comments

And what about mask the url, to keep the idea that it stays the same ?
im not sure what you mean by that. can the url in the top bar of the browser change when you are changing views or not?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.