I
I
Igor2016-04-30 21:42:55
Angular
Igor, 2016-04-30 21:42:55

Is a non-SPA application possible with Angular2?

Good day! I decided to slowly start learning Angular2 and immediately a question arose, to which I have not yet found an intelligible answer. The bottom line is this:
In the first version of the framework, it was possible to easily construct non-SPA applications when server routing was fully used and all markup was rendered there. That allowed simply hanging ng-controller="" on the element and using such a controller to fully manipulate the data and already rendered elements.
I don't understand how to repeat this in Angular2. Creating a component necessarily requires a template (-url). Therefore, using a component will inevitably lead to the replacement of the rendered markup, i.e. it will be replaced by a value from the component's template.
What if I want to fully render the markup on the server, if I don't want to dynamically load templates - Angular2 doesn't allow that? :(

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ilya, 2016-04-30
@FireGM

Maybe. With a bunch of crutches and elusive bugs. Better take react.

B
bromzh, 2016-05-04
@bromzh

Well, the second angular without crutches can be rendered on the server.
You can also make a root component with a template <ng-content></ng-content>and a 'body' selector. Although yes, if you only need a View layer, then you need to take the acc. tool (react, polymer, etc).

X
Xandrio, 2017-05-19
@Xandrio

why use angular for non-spa?
Unfortunately, I can’t answer anything on the question, but you understand, each route initializes the anuglar application in a new way, why do you need this?
Totally wrong approach.
There are a bunch of other frameworks for this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question