So, I am looking to build something with AngularJS. Liking what I see so far, but there is something nagging me.
How do I make angular generate forms (and possibly routes) by looking at my model definitions?
I obviously have to translate the Python to Javascript and send it to the client, but can Angular do this? Is it possible to generate CRUD interfaces by looking at the models? I cant seem to find any info on this and I would rather not spend a lot of time on angular if this is impossible or very difficult.
If angular is not well suited for this, any suggestions for a javascript framework that is?
I'm not sure what your specific need is (let me know and I can elaborate,) but I think the best way to accomplish what you're looking for is to invest some time developing a REST interface.
Defining each python model as a resource will take the guess work out of the interface. There are even concepts in REST for defining "rel" links which expand upon what states are available to transition to.
Say you have a back end
User
model that looks like:You could expose this model as a resource accessible at
/user
Then in your client code you could create a
User
service which returns$resource('/user/:userId', {userId:'@id'});
Now that you have your
User
resource (accessible via aUser
service you have wired into your module...) All you need is to inject the resource into your controller and hack away:Rather than automating model & route generation based on back end code, see if developing a restful interface which is self-defining would serve your needs.