Sounds like you need to ensure that jquery and autocomplete plugin are 
loaded in your index file before angular script refernces.  Why lazy load? 
 Also, check that iElement is the full jquery reference you think it is at 
the time the directive loads:

app.directive('ngAutoComplete', function($timeout) {
console.log("enter")
    return  function(scope, iElement, iAttrs) {
        console.log('iElement is ', iElement)
        console.log(typeof iElement.autocomplete) //when this line returns 
'function' then you'll know you are on the right track
        iElement.autocomplete({
            source: scope[iAttrs.uiItems],
            select: function() {
                $timeout(function() {
                  iElement.trigger('input');
                }, 0);
            }
        });
}
}) ;


On Wednesday, April 16, 2014 9:12:25 AM UTC-6, Diwan Oli M wrote:
>
> Hi , I am facing some issue in loading directive , when i use the 
> directive i am getting error "autocomplete" not an function , after that 
> identify jquery plugin not getting load before directive load , can you 
> please give how to implement lazy load this directive 
>
> app.directive('ngAutoComplete', function($timeout) {
> console.log("enter")
>     return  function(scope, iElement, iAttrs) {
>         iElement.autocomplete({
>             source: scope[iAttrs.uiItems],
>             select: function() {
>                 $timeout(function() {
>                   iElement.trigger('input');
>                 }, 0);
>             }
>         });
> }
> }) ;
>
> i found some code snippet from google , but that is not working 
> function lazyLoad(){
>
> app.directive('ngAutoComplete', function($timeout) {
> console.log("enter")
>     return  function(scope, iElement, iAttrs) {
>         iElement.autocomplete({
>             source: scope[iAttrs.uiItems],
>             select: function() {
>                 $timeout(function() {
>                   iElement.trigger('input');
>                 }, 0);
>             }
>         });
> }
> }) ;
> }
> $(lazyLoad) 
> This method is called , but directive not getting intilized . can you 
> please anyone give the solution for this 
>

-- 
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