1

As I'm using angular route for my SPA, my view page source is empty (only ng-view exists). I see a website developed by react , has the similar functionality. But when I see the page source, content is there. (ex for angular, ex for react)

How is it possible in react ? And why not in angular? Any idea?

Edit: As crawlers like google, supports SPA crawling since a few years ago, Is it really necessary to use server side rendering?

2 Answers 2

3

Server side rendering might not be implemented in angular project which you are looking at, that's why you are not able to see the rendered html. React and angular2 has the feature of server side rendering, which means you can render html from your script on server and send that html to client.

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

3 Comments

It is always better to do server side rendering, even if some search engine says that it executes your script for SEO. Page speed, time to first paint, User experience, rendering in javascript disabled environment, and also SEO, all these things matters very much according to me. All these things are easy to integrate and have good outcome when we use server-side rendering using any frameworks or library.
Thanks. And how about XMLHttpRequest ? As data is fetching by ajax request, how does server side handle this? Any idea or approach?
You can fetch that too on server and pass fetched data to your components and the components will render html with the given data. I have used this technique by following this boilerplate of reactjs github.com/reactGo/reactGo
2

You can see only in page sources ng-views because it doesn't execute JS what is needed to render another elements in your SPA. React can be rendered on server side and gives rendered HTML to your browser while Angular is rendered only in your browser

1 Comment

Thanks. But it seems that is a javascript independent issue.

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.