Is it possible for Angular 2 to ignore whatever comes before a route/path? I'm using Angular 2 on my EpiServer website. When I press a link using Angular, it removes whatever path that comes before it.
For example:
User navigates to /jobs/application/step1.
He or she performs some action on the page, then presses a button to go to /jobs/application/step2.
Angular then removes /jobs/application/ from the path and the url becomes /step2.
Is it possible for Angular to continue using the current path and put the step 2 path on /jobs/application/step2?
Related
I have 2 routes defined as homepage and page1. I am going to page1 from homepage by this.router.navigation(with some queryparams).Now once i go to page1, i have some filters,which i can add to get particular data from api.Once i add those filter i change the page1 url by this.router.navigation(with some queryparams).After adding/deleting multiple filter , my url changes many times..Now i have a back button which upon click should navigate me to Homepage.
1.I have tried using history.back/location.back.But i have to click multiple times.(i see that navigationstart gets called multiple times)
2.i have tried a solution using rxjs pairwise
But i am not able to get the previous page(homepage).
3.This is just a situation.Basically i have to get the route of the preious page.I can't hard code the path in backFunc,Because this has to be generic for all of my other similar types of pages.I can come to page1 from any other page, and should be able to go back to the respective page.
Am i missing something very obvious , does Angular 4 provides any way to tackle this?
I'm slightly confused by the question but it should be as simple as just navigating to the homepage by using router.navigate. Failing that, try using https://angular.io/api/common/Location service's back function.
router.navigate has extra parameters like "replaceUrl".
If you set it to true (when you change query params), the browser will consider you don't change page. So an history.back will works.
Have a look at https://angular.io/api/router/NavigationExtras.
this.router.navigate(['/page1'], {replaceUrl: true, queryParams:{...}});
I am working on an Ionic-1 App. I am terrible confused in managing the back history of my app. Consider this scenario:
Start from home page then
Does a 3 step user registration process
After the end of user registration redirect to records page
Now clicking back button (hard or soft back) I want to navigate back to home instead of cycling through user registration process. There are other scenarios like this where back behavior needs to be modified. Are there any references around to implement back behavior systematically? Should I manually define view hierarchy tree structure and somehow figure out where in tree current view is and then go to parent?
As per my suggestion you should pass parameter say 'extraparams' in your url and set it value to 'home'.And on record page controller then make a function on back button say 'goBack()' where you can check if value of 'extraparams' is 'home' and then use $state.go() to navigate to home view.
If you can keep and maintain each and every section using state approach then you can redirect to home page or what ever the page you prefer to redirect to.In that way you have to implement back button like this way, $state.go('homeSate');
or if you can keep 3 steps(registration) as sub states and have try by injecting $rootScope to your controller in which allows you to access your parent(home).
I have recently started working on angular JS.
Currently i am using $location.replace() method, but it clears only the current state. What i want to do is to clear entire history stack of my Angular Single Page Application: Example:
I have 3 routes on my Angular SPA application : #loginPage, #registerPage, and #homePage.
First my application lands on #loginPage, on that page after clicking register link #registerPage is called, on clicking submit button on successful registration #homePage is displayed.
Now, before clicking submit button i want to let user to traverse the back path i.e. #registerPage to #loginPage.
However, After successful registration, i want to restrict user from traversing the path.
So is there any way possible i could restrict user from traversing entire history at specific point.
I have an angular page that I want to use a plugin like intro.js to demo the different features of the page. However, the issue is that not the entire page is displayed on load. The user is presented with an input box at first that they have to fill out with an id and hit submit. Once they hit submit, the page makes an $http post call and then displays the rest of the page with the data and the other features.
So in this situation, what is the best way to demo this page when only a part of it is display at the beginning? I had 2 ideas
Use a static image of the full page and do a demo on the image
Have a demo button that presents the first part of the page and then when the user submits the id, provide a separate button that demos the rest of the page features
Are those the only 2 ways to do it? Is there any other way?
there are 2 ways
once initial demo is complete, add a hint button (it is feature in intro.js) and restart demo once user click hint
use programmatic way to add steps. first display 2 steps, let user submit the form and on load of controller. restart introjs again
I am using angular introjs in my project on a page for the first time. It works fine and I am able to use customized options too. But want to navigate to another page through the steps.
For example, on first step I click next, the second step should be navigation to another page, and not the step in the same page.
Is there an option under ng-intro-options in angular introjs for navigating to other pages aswell?