Closed agamdua closed 10 years ago
@gpranav88 - branch is dj-ng.
I'm tired of configuration madness, written zero code today. 5 options in Issue, go with one and tell me which looks best.
Completely your call, please comment answer after reviewing and reassign to me. I'll modify AngularJS accordingly.
I'm off to rest. No, not REST. rest. bye. (yes, it gets frustrating, I hate broken things).
Kartik's code written today can be pulled in later, more worried about having a homepage render at all at the moment.
Django's built in templating engine has syntax which is similar to Angular. Both use {{}} for variables. This could be a source of the issues you're facing.
Use the %verbatim% tag in Django to prevent it from rendering the template server side .
Kartik's code written today can be pulled in later, more worried about having a homepage render at all at the moment.
— Reply to this email directly or view it on GitHubhttps://github.com/agamdua/clothzy/issues/18#issuecomment-33140740 .
@hsinha - Na, I've taken care of that using an $interpolator: https://github.com/agamdua/clothzy/blob/dj-ng/clothzy/static/js/clothzy.js#L39
The routes aren't being recognised, I think its on the Angular connection side.
Somewhere I've read that $resource doesn't play well with Django-REST. Its counterintuitive, since the whole point of the $resource wrapper over $http is for RESTful interaction, so I've still kept that there.
Can't really evaluate that though until the 404 to the template/partial disappears and our site appears.
we aren't using the django templates at all, so no chance of syntax collisions. I checked by disabling CORS, and other changes to clothzy.js, got a 404 error for home.html. Moved the home.html to static folder instead of templates, and it worked. Changed the route(added static in path) as: .when ('/',{ templateUrl:'static/home.html', controller:'homePageController' }) Guess you can't access django's template files from client. Now api requests may have a CORS issue, but from what i read, it shouldn't be a big issue.
cors should be handled by the django-cors package. I think I forgot to add it to requirements, I'll just do that.
Also, collecting templates is a pain in the thing in Django, it'll work if we add it to templates dir.
You're right, at the moment we aren't using Django templates, since the templates extending etc is all commented out: https://github.com/agamdua/clothzy/blob/dj-ng/clothzy/static/home.html#L1
And $interpolation doesn't affect the Django code if we aren't using the templates, so can switch that out tomorrow.
I am absolutely sure that its a 'semi-colon' kind of error. Some basic thing missed out.
Always this. Always.
At peace now. See you guys after lunch, thanks @hsinha and @gpranav88!
For the record, this is what Pranav's commit just did:
fixed.
fixed.
Here's the situation:
They don't work together.
The problem is not data receiving, have not reached there yet.
Django is not recognising the AngularJS routes / vice versa - there is a 404 or GET request for a wrong file, e.g., on localhost/product(s)/1 it shows 1.html as a 404.
I am absolutely sure that its a 'semi-colon' kind of error. Some basic thing missed out.
Another pair of eyes required, hence assigned to Pranav.
Pranav: There are two approaches which are quick & promising:
Just please check the Django side, which one resembles our code closer, I'll remodel the Angular according to that.
Longer options:
Wild card: http://django-angular.readthedocs.org/en/latest/index.html Well maintained, but doesn't seem to use an API - no idea beyond that.