Harpreet
Harpreet

Reputation: 1607

Jade + AngularJS

Recently, I started reading Jade and I have an experience of working with AngularJS.

I came across certain scenarios where people are using Jade along with AngularJS.

However what I understand is that if we are using AngularJS, we can use AngularJS features(directives majorly) and can avoid Jade.

Any suggestions?

Upvotes: 2

Views: 3915

Answers (3)

Amulya Kashyap
Amulya Kashyap

Reputation: 2373

Here are some points for your answer :

  1. Jade is a template engine for HTML

  2. Basically used for fast processing of HTML

  3. If you are working with AngularJs then you don't need to use JADE

  4. You can define HTML engine with Angularjs & Node.js like this :

    app.set('views', path.join(__dirname, 'views'));  
    
    app.engine('html', require('jade').renderFile);
    
    app.set('view engine', 'html');
    
  5. Using HTML instead of Jade makes easier for you to understand HTML code.

  6. Jade has a fallback of using its indent and spacing. It makes bottleneck task for anyone to manage spaces or indents/tabs.

  7. Angular mostly works with dynamic content and uses XHR requests and response so using JADE according to me isn't good idea at all.

Currently I'm working with MEAN stack in which I use HTML with Node & Angular. And hence for my personal views. I should say that plain HTML is best to used rather than any templating engine like JADE, EJS, etc.

Upvotes: 3

akardon
akardon

Reputation: 46046

Jade is just a view engine on the server-side which makes your HTML templates much less verbose with it's cool syntax. Whereas AngularJS runs on the browser (client-side). You can use Jade templates in conjunction with AngularJS, that's what I'm currently doing on one of my projects.

To be honest it has not been a good practice and using them together makes the job a bit confusing but les verbose.

Upvotes: 0

deadlocked247
deadlocked247

Reputation: 111

Jade is simply a way to preprocess HTML, while Angular will bind data from the controller to the view and vice versa, which can be updated through client events.

Upvotes: 0

Related Questions