场景: AngularJS做 登录页面,单独 引 JQuery 和 AngularJS文件
webapp/@H_502_4@
|---lib/@H_502_4@
|------angular@H_502_4@/@H_502_4@
|---------angular@H_502_4@.min.js@H_502_4@
|------jquery/@H_502_4@
jquery@H_502_4@.min.js@H_502_4@
|----------@H_502_4@login.html@H_502_4@@H_502_4@
|----------l@H_502_4@ogin.js@H_502_4@@H_502_4@@H_502_4@@H_502_4@
@H_502_4@@H_502_4@
l@H_502_4@ogin.js 内容如下:@H_502_4@
function loginController($scope,$http,$log){@H_502_4@@H_502_4@
$scope.login = function(){@H_502_4@@H_502_4@
if(!$scope.userCode || !$scope.password){@H_502_4@@H_502_4@
var userInfo = {userCode :$scope.userCode,password:$scope.password@H_502_4@@H_502_4@@H_502_4@@H_502_4@};@H_502_4@@H_502_4@
$http.post("userLogin",sans-serif; font-size:16px; line-height:25.92px; text-indent:32px">userInfo@H_502_4@).success(function(){@H_502_4@@H_502_4@
解决方法一:将 js 文件名称修改为 login-ctrl.js@H_502_4@@H_502_4@
在login.js文件顶部 添加@H_502_4@@H_502_4@
angular.module('login',[]);@H_502_4@@H_502_4@
angular.module('login').controller('loginController',sans-serif; font-size:16px; line-height:25.92px; text-indent:32px">loginController@H_502_4@);@H_502_4@@H_502_4@ @H_502_4@@H_502_4@
原文链接:https://www.f2er.com/angularjs/149004.html