Saturday, 15 August 2015

javascript - NG-Click not working in Chrome but works in FireFox -



javascript - NG-Click not working in Chrome but works in FireFox -

i have ng-click alter amount of elements on page (that coming api call). ng-click utilizes drop downwards box works in firefox. discovered isn't working in chrome when co-worker started working on service. have no thought why wouldn't work , help appreciated. i've attached jsfidle code.

http://jsfiddle.net/pay3b/

javascript:

app.controller("appctrl", function($http, $scope){ var app = this; $scope.toload=50; $scope.page= 0; $scope.sortarray = []; $scope.filterlist = ""; 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) } }

html:

<body ng-app="app" ng-controller="appctrl app" 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%"> <option value="10" ng-click="changeload(10)"> 10 </option> <option value="25" ng-click="changeload(25)"> 25 </option> <option value="50" ng-click="changeload(50)"> 50 </option> <option value="100" ng-click="changeload(100)"> 100 </option> <option value="1000" ng-click="changeload(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>

you should utilize 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); }; });

javascript angularjs google-chrome angularjs-ng-click

No comments:

Post a Comment