1
我收到錯誤controller.js角JS - 不是函數
controller.js
angular.module('myApp', ['ngRoute', 'ui.router']).controller('authCtl', ["$scope", "$rootScope", "loginService", function($scope, $rootScope, loginService) {
$rootScope.bodyClass = "focusedform";
$scope.submitForm = function() {
loginService.userAuth($scope.username, $scope.password);
}
}]);
factory.js
angular.module('myApp').factory('loginService', ["$http", "$q", function($http, $q) {
userFactory = {};
userAuth = function(username, password) {
console.log(username + '' + password);
};
return true;
}]);
你返回從登錄服務真。使用附加的userAuth函數返回一個對象或其他東西。 – Phix