ngTagsInput icon indicating copy to clipboard operation
ngTagsInput copied to clipboard

AutoComplete List does not Display

Open DevQueen opened this issue 7 years ago • 1 comments

I am unable to get the AutoComplete list to display. My service returns json model: TagID: 1, text:MyText but the AutoComplete list never displays. My HTML:

<tags-input ng-model="tags" tag-class="{even: $index % 2 == 0, odd: $index % 2 != 0}" on-tag-added="addTag(tags)"> <auto-complete source="loadTags($query)"></auto-complete> </tags-input>

My Controller Code:

 $scope.loadTags = function ($query) {
       var tags;
       contractorService.gettags()
       .success(function (data) {
           tags = data;
            tags.filter(function(tag) {
               return tag.text.toLowerCase().indexOf($query.toLowerCase()) != -1;

           });
       });
   };

What I have discovered is that for some reason it does not like the Json returned from the Ajax call to my ASP.NET MVC Controller

  public async Task<ActionResult> GetMajorTags()
        {
            majorId = UserInfo.intMajorID;
            var tags = await CompanyClient.GetAvailableTags(majorId);
            return Json(tags, JsonRequestBehavior.AllowGet);
        }

Even using it like below without going through my service:

    $scope.loadTags = function (query) {
        $http.get('/SSQV4/SSQV5/Contractor/GetMajorTags')
            .then(function(res) {
                return res.data;
            });
    };

It will not display the list even though the data comes back in EXACTLY the same format from each.

DevQueen avatar Jul 10 '17 19:07 DevQueen

I've had the same issue, it's very frustrating.

Alexabix avatar Dec 07 '17 15:12 Alexabix