无法使用Angular.js和Node.js获取控制器端值

时间:2016-07-01 12:09:33

标签: javascript angularjs

我有一个问题。我无法使用Angular.js在控制台中获取控制器端值。我正在解释下面的代码。

<!DOCTYPE html ng-app="odiaDocLogin">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to Odia Doctor Admin Panel</title>

<link href='http://fonts.googleapis.com/css?family=Roboto:400,300,500,700,900' rel='stylesheet' type='text/css' />
<link href='http://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css' />
<link rel="shortcut icon" href="/img/favicon.png" type="image/x-icon">
<!-- Styles -->
<link rel="stylesheet" href="font-awesome-4.2.0/css/font-awesome.css" type="text/css" /><!-- Font Awesome -->
<link rel="stylesheet" href="/css/bootstrap.css" type="text/css" /><!-- Bootstrap -->
<link rel="stylesheet" href="/css/style.css" type="text/css" /><!-- Style -->
<link rel="stylesheet" href="/css/responsive.css" type="text/css" /><!-- Responsive --> 
<script src="/js/angular.min.js" type="text/javascript"></script>
</head>
<body style="background-image: url('images/resource/login-bg.jpg')" ng-controller="loginController">

<div class="login-sec">
    <div class="login-sec">
    <div class="login">
        <div class="login-form">
            <span><img src="images/logo.png" alt="" /></span>
            <h5><strong>Identify</strong> Yourself</h5>
            <form action="#" method="post">
                <fieldset><input type="text" placeholder="Username" class="logininputdiv" /><i class="fa fa-user"></i></fieldset>
                <fieldset><input type="password" placeholder="Password" class="logininputdiv" /><i class="fa fa-unlock-alt"></i></fieldset>
                <label><input type="checkbox" />Remember me</label><button type="button" class="blue" onClick="document.location='dashboard.html'">LOG IN</button>
            </form>
        </div>
        <span>Copyright © 2015 Odia Doctor</span>
    </div>
</div><!-- Log in Sec -->   
<script src="/adminController/loginController.js" type="text/javascript"></script>
</body>

</html>

我的控制器端代码如下所示。

var login=angular.module('odiaDocLogin',[]);
login.controller('loginController',function($scope,$http){
    console.log('hello');
})

这里我需要当用户加载页面时控制台消息应该显示但不会发生这种情况。我正在使用Node.js作为后端。请帮我解决这个问题。

0 个答案:

没有答案