I used to use the handlebars and now began to study backbone.js, but read that the backbone does not work without underscore. I tried to find the answer to this question , but unfortunately to no avail. Is it possible to completely substitute the underscore for handlebars in backbone? Thanks!
Is it possible to completely substitute the underscore for handlebars in backbone?
No. You can't remove Underscore. However, you can use Handlebars as a template system for Backbone.
Here's a StackOverflow answer that goes over the basics:
https://stackoverflow.com/a/10843963/2793460
Related
I am comparing lodash.js and underscore.js libraries to use with my angular project.
Some research says lodash is more robust and proven one though size wise it is bigger.
My question is which one of these two has better compatibility with Angular 1.X version ?
Can someone answer with at least one reason.
I was reading about Handlebar.Js and to me it tries to imitate what Angular.Js does. My question is whether handlebarJS is mainly for frameworks which are using expressions poorly or we might need to get help from HandlebarJS inside application on Angular framework?
Indeed, Handlebars does somethings that AngularJS already provides out of the box: templating (e.g. taking a string like "here is {{myvalue}}!" and replacing the right places with the rights values). Handlebars is generally used alone, or together with "light" frameworks that don't include templating by default (Backbone for example).
I have seen many people using handlebars templates with BackboneJS instead of underscore templates, even underscore is hard dependency of BackboneJS. Can anyone please tell me benefits of doing so?
Handlebars:
Compatible with mustache templates - what cam be used to use same syntax, or even templates
More readable syntax
Underscore:
No need to load extra library for template
Underscore its not only template engine. It has 80+ useful functions for working with objects, arrays and collections.
On my point of view there are a lot of advantages and disadvantages of using these libs according project specifics.
It depends on where you are using and what you are needing a template for.
For example, like Evgeniy said, when you want to deal much with collections, such as SORT, or extracting a particular field's value (from a result set), extracting UNIQUE values ... these are the places where you will be better off using Underscore.
Going back to what Evgeniy said, I think it is those 80+ useful functions that make Underscore significant.
I prefer Handlebars for Templates, because I feel that handlebars is more readable and a bit less complex than Underscore when it comes to Template needs. Again, that's my preference.
But bottom-line is, I user Underscore for the Functions it provides and Handlebars for Templates.
Hope this helps.
Underscore provides the basic functions needed for any project and thats the advantage of that.
At the same time Handlebars can be efficiently used in a project which needs to do lot of formatting/ common functions with some set of data. For e.g. if a project has requirement of displaying a name in a specific format and has to be in sync across the application, then handlebars come in handy.
We can simply write a handlebar and call that function from all the places in the application.
In short i would say both are handy for development and they are wonderful in their own ways.
Hope i have not confused you :)
do you have any experience with integrating AngularJS component into existing BackboneJS application?
Could you just briefly give me some help, what should I do to make it work?
Thank you
Igor
I was able to make it work after all
for the future reference - this gist helped me a lot: https://gist.github.com/dgs700/6197687
anyway, Charles is right - it is definitely not nice to combine these two frameworks (in my case, it was not my call to do so...)
Angular scope will overcome the backbone scope. There is no point using those two frameworks on the same project. Mixing those two will result in a poor designed project.
Either stick to Backbone or replace it with Angular.
I'm currently learning Angular|AngularJS|Angular.js. I'm curious, is there an official name for this AWESOME framework? If so, what is it?
I see AngularJS used a lot with 'Angular' being the brevity option. However, I personally prefer Angular.js because I see projections like Angular.dart highlighting one of Angular's strong points.
In my mind, I view it as
Angular - The name of the framework (like .NET)
.[Language]
My opinions aside, I'm trying to learn if there's an 'official' name. Is it AngularJS or Angular.js?
Thank you!
According to Wikipedia it's AngularJS.
https://en.wikipedia.org/wiki/AngularJS