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
Post a Comment