Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actual use of Jade template and angularjs

I am building a website using nodejs and express. How to make divisions in a page dynamic? Is Jade used for that? if not how to do it?what is angularjs used for? Please help i searched a lot on google and i couldn't get a clarity in the usage of them.

like image 638
Haresh Avatar asked Jan 08 '14 07:01

Haresh


People also ask

What is the use of jade file?

Jade is a template engine for node. js and the default rendering engine for the Express web framework. It is a new, simplified language that compiles into HTML and is extremely useful for web developers. Jade is designed primarily for server-side templating in node.

What is AngularJS template?

In AngularJS, templates are written with HTML that contains AngularJS-specific elements and attributes. AngularJS combines the template with information from the model and controller to render the dynamic view that a user sees in the browser.

Why do we need AngularJS NodeJS?

you don't need node. js to run your application, but you need node. js to develop your angular app to use necessary tools. NodeJS gives you the tool npm that allows you to download libraries and packages that you use in Angular.

Which is best with AngularJS?

Webstorm Webstorm is the best IDE for AngularJS development that includes an Angular online editor and is compatible with Node. js, HTML, and CSS, along with all current technologies.


1 Answers

Jade creates the html used in the browser on the server-side. The browser executes a request to the web-server, the web-server executes Jade, which will generate the html that will be sent to the browser. This server-side content generation has been very common in the last ~20 years, but it has quite some cons when building rich internet application. Mostly this has to do with performance and client state tracking.

AngularJS is a client-side MVC/MVVM like framework to build so called Single Page Applications (SPA), which allows you to have the complete user interface flow, all content generation and state tracking to be done at the client side. It even allows you to build offline applications. From the developer point of view this feels much more like building a desktop application where the client knows the state of the user interface. From the user point of the view the website will respond much smoother and snappier because the UI is all generated locally.

Note: SPA does not mean that you can only have one page in your website. It's a technical term where the browser downloads one page (~/index.html), which contains the complete or partial web application. The user technically never leaves this page, but the content (pages) is dynamically swapped in and out from this placeholder page.

To most common way to provide data to a SPA is via RESTful web services. AngularJS comes with builtin support for REST.

Some developers combine server-side content generation techniques with AngularJS, but there's actually no real need for this.

like image 103
null Avatar answered Oct 16 '22 19:10

null