Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crappy solution to Issue #422: Loading cell templates with $.ajax cannot take advantage of $templateCache #601

Closed
wants to merge 2 commits into from

Conversation

andrewluetgers
Copy link

please feel free to ignore this crappy, very-quick, solution to this issue, I have not thoroughly tested.

@ProLoser
Copy link
Member

ProLoser commented Aug 5, 2013

The proper way to leverage $templateCache would be to use $http, however I'm assuming that the team chose to use $.ajax to avoid the extra overhead of a $scope.$apply(). Is this the reason? If not, perhaps it would be better to refactor to $http instead then?

@andrewluetgers
Copy link
Author

I am new to angular and not aware of the $templateCache integration in in $http. That indeed seems the way to go, this was a quick fix following the existing code that I thought id post to keep this issue moving forward.

@c0bra
Copy link
Contributor

c0bra commented Sep 3, 2013

@ProLoser I think the reason was synchronicity. Elsewhere down the initiation chain, the code expects the cell templates to be there when building the grid. It does not block and wait for Ajax calls to complete.

I just tried to use $http and it all works up until the point that you actually want the content from the template in the grid. There doesn't appear to be a way to "rebuild" the grid such that the cell and header templates are reworked, unfortunately.

I think @andrewluetgers is on to the best way to handle this without rewriting a lot of ng-grid's internals. I have some unit tests that can be applied so I'll try to get them and this PR merged together.

@c0bra
Copy link
Contributor

c0bra commented Apr 22, 2014

Appears to have been fixed with 1ee01f4 in 2.0.8 branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants