google / lovefield

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.
https://google.github.io/lovefield/
Apache License 2.0
6.81k stars 366 forks source link

lovefield-directive? #43

Closed objectbb closed 9 years ago

objectbb commented 9 years ago

First off, I would like to express a heart felt thank you for developing this much needed browser base SQL engine. It has been an unexpectedly agonizing experience just find a tool like this.

Right now, I am struggling with applying the code within an angular application. The current example has the code in the main body of the application, which is great for a simple demo; but not so for placing the code within a reusable service, controller, etc.

Not sure if this is the proper place for a request, but is there in the works of developing an angular directive for lovefield library?

freshp86 commented 9 years ago

Hi objectbb and thank you for your kind words!

We have a demo that uses AngularJS, see https://github.com/google/lovefield/blob/master/demos/olympia_db/angular/demo_angular.js#L57, where Lovefield is wrapped with an angular service. We will soon have more demos (including one with Angular), see announcement at https://groups.google.com/forum/#!topic/lovefield-users/rSl9dzJb-lI.

There are no current plans for an angular directive, but it seems that wrapping lovefield in an angular service is fairly convenient.

objectbb commented 9 years ago

After writing the request, I was able to get to work with what I have by following the example (closer). Initially I wrap it within a directive, following other examples i.e angular-breezejs; but that didn't resolve my scoping problem. Once I placed my code within a standalone function then called it, when creating the service; it worked.

kutomer commented 8 years ago

I guess that this is too late for you, but if anyone else encounter this issue, I've already wrapped lovefield with an angular service for convenient, hope it will save some time and trouble for future users. You can find usage examples and installation instructions at ng-lovefield