What's the use of Jade or Handlebars when writing AngularJs apps

前端 未结 10 1182
情歌与酒
情歌与酒 2020-12-07 08:38

I am new(ish) to the whole javascript full stack applications, and completely new to Angular, so I was hoping somebody can put the record straight for me here.

Why w

10条回答
  •  春和景丽
    2020-12-07 08:48

    1. You don't need to use Handlebars with AngularJS since it has it's own template engine.
    2. The reason they use Jade, because it's just a server renderer which will be compiled to html and served by angularJS later on the frontend.

    So TL;DR, on server, you can use whatever language [jade,haml,...] to generate just html structure for your application, it doesn't have anything to do with angularJS since it will render and work with HTML at runtime on frontend.

    You don't have to use Jade on server, and I suggest not using since it will confuse new developers. In projects that you see they use Jade only because it's cleaner and they are used to it, and if it uses with angularJS, it's only job is to generate plain html without any logic.

提交回复
热议问题