AngularJS and Handlebars - both required or not

后端 未结 1 1842
梦如初夏
梦如初夏 2020-12-23 10:08

I need to know if AngularJS is used as js framework for the front-end, do we need Handlebars separately for template-engine? ... as in my view template-engine functionality

相关标签:
1条回答
  • 2020-12-23 10:37

    You are right, Handlebars and Angular together would be pretty useless.

    Handlebars and Angular are completely different things.

    Handlebars is a template engine. You write a fancy templatey-string, give it a JSON object, and it renders out HTML from the data. There's no data-binding, no updating, it's just a once-off render.

    AngularJS is an HTML compiler and databinder. Angular will look through the HTML for angular-templating tags, interpret/compile them, and update the HTML with changes to data on a given controller scope. Angular doesn't just render an HTML string once, it compiles the HTML, binds it to a scope, and updates when data on that scope changes.

    Handlebars in one picture

    AngularJS databinding/templating in one picture

    AngularJS's HTML compiler in one article

    AngularJS's whole overview/guide, so you can know how it actually works

    0 讨论(0)
提交回复
热议问题