Hi,

Instead of directive will $resource not solve your purpose? Please refer to 
the documentation here:

https://docs.angularjs.org/api/ngResource/service/$resource

Regards,

Vaibhav Gupta



On Monday, 18 April 2016 21:09:43 UTC+5:30, Carlos alberto wrote:
>
> Hello everyone,
>
> what do you think of the approach to create directives that expose 
> services?
>
> Example have a directive to do then get requests the UI would have just 
> that:
>
> <api-http id="clients" uri="rest/clients"></api-http>
>
> <button ng-click="clients.get()">search clients</button>
>
> <table>
> <tr ng-repeat="client in clients.results.data"> 
> <td>{{client.name}}</td>
> </tr>
> </table>
>
>
> api-http is a policy that exposes an api rest via ui, the button I call 
> the api which was exposed in the id, calling the get that stores the result 
> in api under the variable result, and display the results in the table 
> below, which They think of this approach?
>

-- 
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 https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to