Actual use of Jade and angularjs template

I am building a site using nodejs and express. How to make sections in a dynamic page? Is Jade used for this? if not how to do it? What is angular used for? Please help me search a lot on google, and I could not get clarity about their use.

+15
angularjs pug express
Jan 08 '14 at 7:03
source share
2 answers

Jade creates the html used in the server side browser. The browser makes a request to the web server, the web server runs Jade, which will generate the html that will be sent to the browser. This generation of server-side content has been very common over the past 20 years, but it has many drawbacks when creating a rich Internet application. This is mainly due to monitoring the performance and status of the client.

AngularJS is client-side MVC / MVVM, for example, for creating the so-called Single Page Applications (SPA), which allows you to have a full stream of user interface, all content creation and state tracking should be done on the client side. It even allows you to create standalone applications. From the developer's point of view, this is much more like creating a desktop application in which the client knows the state of the user interface. From the point of view of the user, the website will respond much more smoothly and smooth, because the user interface is created locally.

Note. SPA does not mean that you can only have one page on your website. This is a technical term when the browser loads a single page (~ / index.html) that contains a full or partial web application. The user technically never leaves this page, but the content (pages) dynamically swaps and leaves this placeholder page.

The most common way to provide data to the SPA is provided by RESTful web services. AngularJS comes with built-in support for REST.

Some developers are combining server-side content generation technologies with AngularJS, but there is really no real need for this.

+36
Jan 08 '14 at 8:34
source share

Jade is used as a template engine both on the server side and on the client side. Yes, it can dynamically refresh the page, you just need to compile your jade templates for javascript functions (using jade -c or something similar).

Yes, you can use angular.js with it, but I don’t see the real need to use two template mechanisms in your project. Offering just stick to jade if you don't know what you are doing.

0
Jan 08 '14 at 10:05
source share



All Articles