jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 294 forks source link

Angular 2 Support? #253

Open eltronix opened 8 years ago

eltronix commented 8 years ago

Hi, what's the state of angular 2 support?

adrienbrunet commented 8 years ago

See Issue #219 . So far, it's not supported. It's getting time to do it though. Do you plan to start it? :smiling_imp:

eltronix commented 8 years ago

Thanks for pointing out the original issue. Unfortunately i'm hopeless when it comes to frontend matters but I will pass on the word.

We're thinking of building an open source enterprise stack based on django, REST and modern frontend frameworks like angular. Therefore we're looking at projects that encapsulate the best patterns. This is how I stumbled on your project, it provides a pattern for integrating angular and django. On 4 Apr 2016 2:52 pm, "Adrien Brunet" notifications@github.com wrote:

See Issue #219 https://github.com/jrief/django-angular/issues/219 . So far, it's not supported. It's getting time to do it though. Do you plan to start it? [image: :smiling_imp:]

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/jrief/django-angular/issues/253#issuecomment-205262325

jkosir commented 8 years ago

Well I have some time now so I could rewrite my contributions to support angular2.

Anyway we'd first have to decide if we'll be going for a new module or somehow make this compatible with angular2. Due to different managing of static .js files (webpack, jspm) it doesn't make much sense to load javascript parts with pip any more. Also do we use typescript or es6?

Need to start some discussion on these and similar questions.

jrief commented 8 years ago

If we can reuse the directives (the HTML part) in Angular2, I'd prefer to reuse the existing project and add a new folder named, say, client2. Then we can reuse the server part and only replace the client part.

jkosir commented 8 years ago

In "modern" (es6) web development you wouldn't load a library by adding another script tag, but just npm install it and import it wherever needed. Then you have webpack/JSPM to take care of bundling all the stuff together.

So installing the client side part with pip doesn't make sense any more. While you could probably import js files by path it's unnecessary complex to do so for .js files that are somewhere in python/site-packages directory.

So to go with the flow the client part of django-angular2 has to be available via npm, I would also suggest making a separate repository for it.

http://blog.jhades.org/how-to-create-an-angular-2-library-and-how-to-consume-it-jspm-vs-webpack/

jkosir commented 8 years ago

Also we'd basically have to rewrite everything, since it's a completely different framework. I suppose it's best to get started sooner than later, django url reversing is pretty simple to adapt for angular2, not sure about forms though.

auvipy commented 8 years ago

it would be better to start a new project rather then this i believe as angulr 2 is completely different beast [but nicer] beside we should use jinja2 instead of dtl.

COLABORATI commented 8 years ago

just found this: https://github.com/pselle/django-rest-angular2-example

adrienbrunet commented 7 years ago

@jkosir @jrief Some update here: Emmanuelle Delescolle has been working on a project involving django-rest-framework to use any front end framework afterwards. The idea is to make OPTIONS call and override the metadata generated.

The project is a really early stage right now, we could really benefit from both of your help (or anyone reading this). The idea is to write adapters for both angular1 & 2. (but also react etc etc...)

The project is mainly build around Ember at the moment. But with a few adapters, we should get something working with angular 1&2 pretty soon. Using something like angular-formly, we can then build forms on the go from our django definition.

We've build this with Emma (@nanuxbe) at django under the hood. Please, give me feedback. This new project/approach could be a replacement for that library which is sadly stuck on angular1.

http://drf-schema-adapter.readthedocs.io/en/latest/

timoc commented 5 years ago

Why not try something with Angular 4 that is off the shelf? https://github.com/mika-el/angular-admin-lte