Giorgi Goginashvili Giorgi Goginashvili - 1 year ago 88
AngularJS Question

How to pass dir-paginate item to angular function

I have select tag in html

<select id="selectTerminalGroups" ng-model="selectedGroup" ng-change="showSelected(x)">
<option dir-paginate="x in serverData | itemsPerPage: serverData.length" value='{{ }}'>{{ }}</option>
<input class="getItems" name="Submit" type="submit" value="Renew" ng-click="showSelected(x)"/>

and here is my

$scope.showSelected = function(item)

in angular function my x('item' in angular) is undefined.I want to take this x object in angular

Answer Source

Change showSelected(x) to showSelected(selectedGroup). ng-modal track's current element value..

Edit There is a working Example try this.

var app = angular.module("app",[]);
app.controller("ctrl", function($scope){

$ = [{name:'test1'},{name:'test2'},{name:'test3'}];
$scope.selectedItem = $[0];
$scope.change = function( item )

    <script src=""></script>
  <script src=""></script>
  <body  ng-app="app" ng-controller="ctrl" >
  <select ng-model="selectedItem" ng-change="change(selectedItem)" >
    <option ng-repeat="item in data" > {{}} </option>
    <input name="Submit"  type="submit" value="Renew" ng-click="change(selectedItem)">

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download