Rob,
You can inject $http the same way as $location in your directive's
function.This is the magic of dependency injection :-)
Cheers,
Pawel
On Tue, Jul 24, 2012 at 1:32 PM, Rob Hicks <
r...@hixfamily.org> wrote:
> Philipp,
>
> Thanks, that helps, although the unshifting the $parsers seems odd.
>
> To invalidate the field though, I would need to get access to the $http
> service from within the directive. I searched but only found getting access
> to $location from within the directive. Is the $http service accessible
> within directives? The server needs to be queried to determine if the email
> address has already been used.
>
> Rob
>
> On Tuesday, July 24, 2012 2:14:14 AM UTC-6, Philipp Burgmer wrote:
>>
>> Hi,
>>
>> For information about custom validation take a look at
>>
http://docs.angularjs.org/guide/forms. There's a paragraph "Custom
>> Validation".
>> I think this is what you need ;)
>>
>>
>> Greetings,
>> Philipp
>>
>> Am Montag, 23. Juli 2012 17:51:22 UTC+2 schrieb Rob Hicks:
>>>
>>> Hi,
>>>
>>> App needs to ensure email address is unique.
>>>
>>> See jsfiddle.
>>>
>>> How do I modify the directive to make fail validation for the field?
>>>
>>> Do I need to build a service for the directive?
>>>
>>> Thanks!
>>>
>>> Rob
>
> --
> 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/-/Nx4DNLvBrJoJ.
>
> 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.