Accessing services in the view

Showing 1-3 of 3 messages
Accessing services in the view Adam Wynne 4/9/12 4:08 AM
Hi guys

I'd like to be able to access my services in the view (so if I've written a service called 'auth', I could use something like ng-show="auth.loggedIn"

this (broken) fiddle demonstrates what I'd like to do:

Any help appreciated

Thanks
Adam
Re: [angular.js] Accessing services in the view Pete Bacon Darwin 4/9/12 7:57 AM
In this fiddle the $location service is passed straight through to the scope.  Personally, I would use the controller to give a layer of abstraction between the view and the service by creating a method like your url() method.
Pete

Adam

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/_5z5drd-NukJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Re: [angular.js] Accessing services in the view Adam Wynne 4/9/12 12:57 PM
brilliant - thanks :)