javascript - angularjs ng-click not working -


javascript define controller , call function $hhtp , in $scope define model , function want call:

myapp.controller('profiletweets', ['$scope', '$http', '$location', function ($scope, $http, $location) {  $http({          url: '../profilesname/',          method: 'get'      }).then(function (itemdata) {          $scope.profilesname = itemdata.data;      });   $scope.loaddata = function () {          alert('hiii');      }  }]);

and in html i'm calling function loaddata() show in code below

<div class="form-group">      <select class="form-control" dir="rtl" style="width:100%;" ng-model="profilesname" ng-options="profiles.profile_name profiles in profilesname" ng-change="loaddata()"> </select>   </div>

ng-change not working, nothing happen. how fix it?

i guess had forgot place ng-controller directive, wont work without

myapp.controller('profiletweets', ['$scope', '$http', '$location', function ($scope, $http, $location) {  $http({      url: '../profilesname/',      method: 'get'  }).then(function (itemdata) {      $scope.profilesname = itemdata.data;  });   $scope.loaddata = function () {      alert('hiii');  }  }]);
<div class="form-group" ng-controller="profiletweets">                    <select class="form-control"                           dir="rtl" style="width:100%;"                           ng-model="profilesname"                           ng-options="profiles.profile_name profiles in                                                       profilesname"                           ng-change="loaddata()">                     </select>   </div>


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -