Node.js无法识别angularjs

时间:2016-12-10 02:27:01

标签: angularjs node.js

我在node.js项目中安装了angular包。但它无法识别angular关键字。

enter image description here

2 个答案:

答案 0 :(得分:0)

问题是它无法找到angular.js参考。只需确保您为角度库提供的路径是正确的。

以下是具有相同代码的工作演示,

<!doctype html>
<html ng-app="myApp">
<head>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.min.js"></script>
  <script>
    function Customer($scope) {
      $scope.CustomerName = "abc";
      $scope.CustomerCode = "abc";
    }
    var myApp = angular.module('myApp', [])
    myApp.controller("CustomerObj", Customer)
  </script>
</head>

<body>
  <div id="custScreen" ng-controller="CustomerObj">
    Email :
    <input ng-model="CustomerName" type="text"> <br>
    Password :
    <input ng-model="CustomerCode" type="pasword"><br>
    {{CustomerName}}<br/>
     {{CustomerCode}}<br/>
  </div>
</body>
</html>

答案 1 :(得分:0)

请确保在头部包含角度js库

    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.4/angular.min.js"></script>
相关问题