Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs Angular中的Ajax请求_Angularjs_Node.js - Fatal编程技术网

Angularjs Angular中的Ajax请求

Angularjs Angular中的Ajax请求,angularjs,node.js,Angularjs,Node.js,我是个新手。我正在尝试以angular方式发出警报,并希望向节点服务器发送ajax请求 这是我到目前为止尝试过的代码 作为我的警觉,我不工作 <!doctype html> <html> <head> <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="sty

我是个新手。我正在尝试以angular方式发出警报,并希望向节点服务器发送ajax请求

这是我到目前为止尝试过的代码

作为我的警觉,我不工作

<!doctype html>
<html>
    <head>
            <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css"
          rel="stylesheet">
    <link rel="stylesheet" href="css/mycss.css">
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular-resource.min.js"></script>
    </head>
    <body>
    <form action="#">
            <input type="text" ng-model="url">
            <input type="button" ng-click="a()" value="Click here"/>                
  </div>
    </form>

    <script>

        function a() {
            alert("Hello");
        }

    </script>
</body>

</html>

函数a(){
警惕(“你好”);
}
。。。。。。。。。
函数personController($scope){
$scope.a=函数(){
警惕(“你好”);
}    
}


以下是您实际上没有使用angular的

,因为您缺少ng app指令。我建议你花1-2个小时学习基本功。
<html ng-app> .........

<body ng-controller="personController">
<form action="#">
        <input type="text" ng-model="url">
        <input type="button" ng-click="a()" value="Click here"/>                
</form>
<script>
  function personController($scope) {
     $scope.a = function() {
          alert("Hello");
     }    
  }
</script>