Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I combine Twitter Flight with AngularJS?

A couple of hours ago Twitter released Flight, a component-based framework for JavaScript. Its components are plain DOM elements and communicate through plain DOM events, which its really nice.

I just wonder... can I combine this with AngularJS? If I understand both frameworks correctly I can create "new" elements with AngularJS which could be use by and contain Flight components. And these components can be populated with data by AngularJS. To put it another way: I could AngularJS like I normally would, but the directives are "decorated" Flight components. (Use Flight to create views and use AngularJS for everything else.)

Would that make sense? If not... I don't get the purpose of Flight :(

like image 911
Pipo Avatar asked Feb 02 '13 13:02

Pipo


1 Answers

I understand you want to do the following: Decorate AngularJS directives with Flight components and Flight views.

You could probably create these Flight components within a directive and gain an advantage from the data-binding Angular offers. However, judging from the following:

"Flight enforces strict separation of concerns. 
 When you create a component you don't get a handle to it. "

It seems like Flight does not promote that you speak to these components via data-binding.

Furthermore, directives can be seen as components themselves already. And as for creating views, in AngularJS the DOM is already the view, what reason specifically would you have to use Flight views on top?

Also since the AngularJS is not subscribed to the events that Flight uses it has no way of knowing when the DOM has been modified (I am not sure of this please someone more knowledgeable correct me if I am wrong).

As for making sense. It does not look like Flight is meant to solve the same problems as Angular. I think AngularJS directives solve the same problem as Flight components, but offer a lot more.

like image 90
bbs Avatar answered Oct 19 '22 22:10

bbs