javascript - Angularjs scope update issue -


i new angularjs. facing problem below markup like:

<div class="data-list">     <ul ng-repeat="client in clients | orderby:orderprop | filter:query">         <li><a ng-click="update(client)"  data={{client.id}} href="#">{{client.name}}</a></li>     </ul> </div> <div class="clientid">     {{clientid}} </div> 

and controller like:

function clientlistctrl($scope, $http) {     $http.get('/dummy-data/clients.json', {         cache: false     }).success(function (data) {         $scope.clients = data.clients;     });      $scope.activeclient = {};     $scope.update = function (selectedclient) {         $scope.activeclient = angular.copy(selectedclient);         console.log($scope.activeclient);     }      console.log("after click");     console.log($scope.activeclient);     // sorting list      $scope.orderprop = '-numberofusers'; } 

i want when user click "client name", {{clientid}} updated, scope updates self. , return {} (blank object).

how can {{clientid}} after clicking clientname?

thanks in advance.

you controller not have property clientid , ng-repeat scoped <ul> tags.

change

<div class="clientid">    {{clientid}} </div> 

to

<div class="clientid">    {{activeclient}} </div> 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -