OK, I've got a simple solution. Just use ng-controllers for each embedded
thing and it all comes together exactly as you'd - or I'd anyway - expect.

D.



On Mon, Jun 16, 2014 at 10:16 AM, Sander Elias <[email protected]>
wrote:

> Hi David,
>
> Yeah, I have enough thoughts, some of them are even relevant to your
> problem :-P
>
> David, this is less common as you would think. You are missing the point
> that you can’t use raw JSON data in your view, you need to handle that
> first.
> Mostly this kind of stuff is handled in a template directive, and data is
> loaded via an service. Since you are hitting the 10… limit, you are trying
> to do
> too much in 1 go. Upping the limit is a dead end, if your app grows a bit,
> you need to up the ante again. Not a good idea.
>
> Here is and idea on how to build a template directive. I put the $http in
> there, but you really should make a service out of it!
>
>     app.directive('enpointHandler', ['$http',
>         function ($http) {
>             return {
>                 restrict: "E",
>                 scope : {uri: '='},
>                 template: '<div>{{endpointData.someExistingProperty}}</div>',
>                 link: function (scope, elm, attr) {
>                     scope.$watch('uri', function (uri) {
>                         if (!uri) { return; } //ignore empty uri's
>                         $http.get(uri).success(function (data) {
>                             scope.endpointData = data;
>                         });
>                     });
>                 }
>             };
>         }
>         ]);
>
> <div ng-repeat="room in rooms">
>     <h1>
>         {{ room.room }}
>         <span class="floor pull-right">{{ room.floor }}</span>
>     </h1>
>     <div ng-repeat="api_endpoint in room.api_endpoints">
>        <endpoint-handler uri='api_endpoint'></endpoint-handler>
>     </div>
> </div>
>
> This is just typed up in the browser out of the top of my head, so it
> might not work in 1 go ;)
>
> Regards
> Sander
> ​
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to