Created
February 24, 2015 15:00
-
-
Save JasonStoltz/f0ef0d9255dc5a5e1d83 to your computer and use it in GitHub Desktop.
Using a view presenter in an ng-repeat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sometimes, in angular, you'll want to wrap an object with some view presenter logic, but not modify the underlying resource. | |
If you try something like: | |
`server in serverRequests(requests.resources)` or `server in requests.resources|map:asServerRequest`, you will fail miserably. You will get some depth recursion errors of some sort. There's a reason for it, but I forget the details. The key is to put your wrapping logic an `ng-init`. | |
*/ | |
<div ng-repeat="server in requests.resources" ng-init="serverRequest=asServerRequest(server)"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment