我無法通過單擊按鈕來執行函數。我是剛接觸angularjs的,我可能會犯一個愚蠢的錯誤。我需要建議,因為我嘗試了以前的大多數解決方案。但是,它仍然不適合我。<script> var app = angular.module("myModule.controller", []); app.controller("bar_controller", [ "$scope", "$http", "$window", function($scope, $window, $http) { $scope.OperationalList = function() { $window.alert("calling function!"); $scope.name = data; $http({ method : 'post', url : '/com.az.BusinessRationAnalysis/reportGenerate', }).then(function(result) { $window.alert("succeed " + result.data); req.data={"nome":$scope.name}; $scope.jsonOperationalDataList = result.data; }, function(result) { $window.alert("Ajex call failed"); }); } } ])</script></head><body ng-app="myModule.controller"> <div ng-controller="bar_controller"> Name:<input type="text" data-ng-model="name" /> <button ng-click="OperationalList()">Display Report</button> <p>Hola {{name}}</p> </div> ```I need the window alert to work as a hint that my function is working
ng-click沒有調用我嘗試的所有先前答案的函數
慕的地6264312
2022-09-07 17:59:31