0

I have two different aspx pages which operate using AngularJS. One page is to add a post and on clicking save, I want to redirect to the detailpage.aspx. Can this be done using AngularJS?

3 Answers 3

1

You could always use plain javascript to make a redirect to another server side resource:

window.location.href = '/detailspage.aspx';

By the way, is there any point of having multiple ASPX pages when using AngularJS? Usually a SPA application has a single entry point and multiple REST API endpoints that will be called by this SPA application using asynchronous requests.

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

2 Comments

Thanks for your help. Using ASPX pages is a client requirement. Is there a way to read postID from the URL; example: /details/10. How do I read 10 from the URL in Angular?
This seems to be a server side URL. Angular only deals with client side urls: the part following the fragment (#) identifier. If you want to use some server side parameters that are 2 possible approaches: Have the server script pass this parameter to the SPA application or use window.location.href (which will give you the current url) and parse it manually in Angular. It looks like due to your client's requirements you are violating some important patterns of a SPA application which will lead you to all kind of troubles. It's just against the nature of a SPA application.
1
$location.path(YOUR_URL); or $location.url(YOUR_URL);

$window.location.href = '/index.html';

Comments

0

I do use .aspx Pages as well, and use them as partials, to show their content using ajax. In my opinion you should consider going for a navigation/route provider...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.