Skip to content Skip to sidebar Skip to footer

NG-Click Not Working In Chrome But Works In FireFox

I have a NG-Click to change the amount of elements on the page (that are coming from an API call). The NG-Click utilizes a drop down box that works in FireFox. But I recently dis

Solution 1:

You should use ng-change please see here

<body ng-app="app" ng-controller="AppCtrl" id="body">
<div id="main-table"> 

    <div class="widget-body no-padding">
        <div id="select-more">
            <select class="form-control" name="dt_basic_length" aria-controls="dt_basic" id="box-test" style="width:6%" ng-change="update()" ng-model="selectedItem">
                <option value="10">10</option>
                <option value="25">25</option>
                <option value="50">50</option>
                <option value="100">100</option>
                <option value="1000">1000</option>
            </select>
        </div>
        <table>
            <tbody>
                <tr ng-repeat="information in app.info | filter:searchText">
                    <td>{{information.uuid}}</td>
                    <td>{{information.publisher}}</td>
                    <td>{{information.ts}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

js:

var app = angular.module('app', []);

app.controller("AppCtrl", function ($http, $scope) {
    var app = this;
    $scope.toLoad = 50;
    $scope.page = 0;
    $scope.sortArray = [];
    $scope.filterList = "";

    $scope.selectedItem = {};

    function getData(page) {
        $http.get('/file/filter/' + $scope.toLoad + '/' + $scope.page + '?' + $scope.filterList).success(function (data) {
            app.info = data;
            console.log(data);
        });
    }

    $scope.changeLoad = function (toLoad) {
        $scope.toLoad = toLoad;
        getData($scope.page);
    };

    $scope.update = function () {
      alert($scope.selectedItem);
    };
});

Post a Comment for "NG-Click Not Working In Chrome But Works In FireFox"