简体   繁体   中英

Why angularJS can't get the input value set by jQuery?

I have a script in jQuery that set a text box value :

$('.myDropdown li').click(function () {
    var myInput = $(this).data('input');
    $(myInput).val($(this).text());
});

在此处输入图片说明

it acts as select or combobox and i used it for my own reason. It worked perfectly to me but the problem is in my angularJS

it cannot read the value of an input set by the jQuery..

Here is my code:

$scope.bookFiltering = function () {

        var location = (typeof $scope.bookLocation === "undefined") ? "" : $scope.bookLocation.value.toLowerCase();
        var title = (typeof $scope.bookTitle === "undefined") ? "" : $scope.bookTitle.toLowerCase();

        var callNum = (typeof $scope.bookCallNumber === "undefined") ? "" : $scope.bookCallNumber.toLowerCase();
        var publisher = (typeof $scope.bookPublisher === "undefined") ? "" : $scope.bookPublisher.toLowerCase();
        var subject = (typeof $scope.bookSubject === "undefined") ? "" : $scope.bookSubject.toLowerCase();

        angular.forEach($scope.booksInfo, function (book) {
            var jsonLocation = (book.Location.toLowerCase().indexOf(location) === -1);
            var jsonTitle = (book.Title.toLowerCase().indexOf(title) === -1);
            var jsonCallNum = (book.CallNo.toLowerCase().indexOf(callNum) === -1);
            var jsonPublisher = (book.Publisher.toLowerCase().indexOf(publisher) === -1);
            //var jsonSubject = (book.Subject.indexOf(subject) === -1);

            book.excludeBook = jsonLocation || jsonTitle || jsonCallNum || jsonPublisher;
        });

    };

The code is working in fact the other textbox when inputed is read by angular..

and i noticed that when i just type the value in the input in my customized select it actually read by angular..

How to make a readable input value in angular using my customized select?

I appreciate for others help.. Thank you so much..

Angular不支持在隐藏元素中设置值,而是直接在angular scope更改变量的值,Angular不支持隐藏元素

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM