Angularjs Angular中的Ajax请求
我是个新手。我正在尝试以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
<!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>