mbenford / ngTagsInput

Tags input directive for AngularJS
http://mbenford.github.io/ngTagsInput
MIT License
1.64k stars 541 forks source link

AutoComplete List does not Display #808

Open DevQueen opened 7 years ago

DevQueen commented 7 years ago

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

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.

Alexabix commented 6 years ago

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