0
我angularjs看起來喜歡這個調用頁面加載的功能angularjs
$scope.pload = function() {
$http.get('/WebServices/manageuser.asmx/showdatamanageuser', {
}).then(function (response) {
$scope.getdata = response.data;
console.log($scope.getdata);
});
}
創建我的控制器上的功能,我想打電話給插入後此功能,刪除和頁面加載,所以我調用的函數一樣這
<script type="text/javascript">
var app = angular.module("myApp", ["ngStorage"]);
app.controller("myCtrl", function ($scope, $http, $interval, $localStorage, $sessionStorage, $window) {
var filename = undefined;
var file = undefined;
var filepath = undefined;
//showing table
$scope.pload();
我得到的錯誤是
TypeError: $scope.pload is not a function
at new <anonymous> (VM190 ManageUser:427)
at Object.invoke (angular.js:4842)
at R.instance (angular.js:10695)
at n (angular.js:9572)
at g (angular.js:8881)
at angular.js:8746
at angular.js:1843
at m.$eval (angular.js:17972)
at m.$apply (angular.js:18072)
at angular.js:1841
這裏有什麼問題?
你從哪裏調用函數? – Jax
對於我在ctrl中可以看到的內容,它看起來像是在它定義之前調用該函數。函數調用應該在函數定義之後 – Jax